VS:GetFileN: Difference between revisions

From Vectorworks Developer
Jump to navigation Jump to search
m (1 revision)
No edit summary
Line 5: Line 5:
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<desc>
<desc>
Prompts for the selection of a file. Returns the fully qualified pathname of the selected file. Returns false if the user clicked the Cancel button.
Returns the fully-qualified pathname of the selected file.</desc>
 
Valid mask values include:
*.ext (where ext is the actual extension, such as *.txt)
TEXT (Mac text file)
MCD (Mac VectorWorks file)
**** (all files, either platform)
</desc>


-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<def>
<def>
<funcDef lang="vs">
<funcDef lang="vs">
FUNCTION GetFileN(title :STRING; defaultFolder :STRING; mask :STRING; VAR fileName :STRING) :BOOLEAN;
FUNCTION GetFileN(title:STRING; defaultFolder:STRING; mask:STRING; VAR fileName:STRING) : BOOLEAN;
</funcDef>
</funcDef>
<funcDef lang="py">
<funcDef lang="py">
Line 46: Line 39:
fileName
fileName
STRING
STRING
Output parameter.
 
</line>
</line>
</lineList>
</lineList>
</params>
</params>


-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<return>
<remark></remark>
</return>


-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<remark>
<sample></sample>
On OSX, the defaultFolder has to be just the folder, but on OS9 or on Windows, it can include a filename. Either way, if a filename is present, the file does not get selected in the dialog, so don't bother casing this for platforms -- just make sure that defaultFolder just has the name of a folder.
 
On OSX, GetFileN expects a fully qualified name, using foreslashes, such as '/Applications/VectorWorks'.
</remark>


-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<sample>
<seeAlso></seeAlso>
<code lang="pas">
PROCEDURE Example;
VAR
  major, minor, maintenance, platform :INTEGER;
  title, defaultFolder, mask, fileName: STRING;
BEGIN
  title := 'Select something...';
  GetVersion(major, minor, maintenance, platform);
  IF platform = 1 THEN BEGIN
      defaultFolder := '/Applications';
  END ELSE BEGIN
      defaultFolder := 'C:\Program Files';
  END;
  mask := '*.txt';
  IF GetFileN(title, defaultFolder, mask, fileName)
      THEN AlrtDialog(fileName);
END;
RUN(Example);</code>
 
</sample>


-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<version>
<version>
Availability: from All Versions
Availability: from Vectorworks 2014


This is drop-in function.
</version>
</version>
-----------------------------------------------------------------------------------------------------------
<seeAlso>
</seeAlso>


</vwDoc>
</vwDoc>

Revision as of 17:38, 18 September 2013

.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

Version

Availability: from Vectorworks 2014