VS:GetFileN: Difference between revisions
Jump to navigation
Jump to search
(remark about mask format) |
(add example and comment) |
||
Line 46: | Line 46: | ||
----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ||
<remark> | <remark> | ||
([[User:Orso.b.schmid|Orso]] 2017.01.22): Prompts for selection of a file of type "mask", assigns found path to var "fileName". Mask is case sensitive, returns path with slashes on Mac. | |||
* mask := '*.vwx'; allows selection of files of type .vwx | |||
* mask := '****'; allows selection of any kind of files | |||
* mask := ''; allows selection of NO kind of files! | |||
The GetFileN uses the SDK interface IFileChooserDialog | The GetFileN uses the SDK interface IFileChooserDialog | ||
Line 62: | Line 70: | ||
----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ||
<sample></sample> | <sample> | ||
<code lang="pas"> | |||
PROCEDURE Example; | |||
VAR | |||
fileName, title :STRING; | |||
defaultFolder :STRING; | |||
mask :STRING; | |||
BEGIN | |||
title := 'Select the object library file...'; | |||
defaultFolder := ''; | |||
mask := '*.vwx'; | |||
fileName := 'Drafting Tools.vwx'; | |||
IF GetFileN(title, defaultFolder, mask, fileName) THEN | |||
AlrtDialog(fileName); | |||
END; | |||
RUN(Example);</code> | |||
</sample> | |||
----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
Revision as of 03:11, 22 January 2017
.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix
Description
Returns the fully-qualified pathname of the selected file.
FUNCTION GetFileN(
title :STRING;
defaultFolder :STRING;
mask :STRING;
VAR fileName :STRING) : BOOLEAN;
def vs.GetFileN(title, defaultFolder, mask): return (BOOLEAN, fileName)
Parameters
title STRING defaultFolder STRING mask STRING fileName STRING
Remarks
(Orso 2017.01.22): Prompts for selection of a file of type "mask", assigns found path to var "fileName". Mask is case sensitive, returns path with slashes on Mac.
- mask := '*.vwx'; allows selection of files of type .vwx
- mask := '****'; allows selection of any kind of files
- mask := ; allows selection of NO kind of files!
The GetFileN uses the SDK interface IFileChooserDialog
VCOM:Working with File/Folder Choose Dialogs
the ‘mask’ parameter goes as input to fileChooser->SetDefaultExtension(mask);
VCOM:VectorWorks:Filing:IFileChooserDialog::SetDefaultExtension
(MaKro, 2016.10.18):
- Mask format change in VW2016 on a Windows 7 machine
- Python mask example: '*.txt' if VW-Version < 2016 else 'txt'
Example
PROCEDURE Example; VAR fileName, title :STRING; defaultFolder :STRING; mask :STRING; BEGIN title := 'Select the object library file...'; defaultFolder := ''; mask := '*.vwx'; fileName := 'Drafting Tools.vwx'; IF GetFileN(title, defaultFolder, mask, fileName) THEN AlrtDialog(fileName); END; RUN(Example);
Version
Availability: from Vectorworks 2014