VS:Open: Difference between revisions

From Vectorworks Developer
Jump to navigation Jump to search
m (1 revision)
(Restore lost backslashes)
Line 8: Line 8:


Remember to use Close when you are finished reading or writing to a file.
Remember to use Close when you are finished reading or writing to a file.


If the filename includes a fully qualified path, the path has to use the appropriate notation for the local operating system:
If the filename includes a fully qualified path, the path has to use the appropriate notation for the local operating system:
 
<dir>Macintosh HD:Applications:VectorWorks:Plug-Ins:Data:Notes.txt</dir>
<code>Macintosh HD:Applications:VectorWorks:Plug-Ins:Data:Notes.txt</code>
<dir>C:Program FilesVectorWorksPlug-InsDataNotes.txt</dir>
<code>C:Program FilesVectorWorksPlug-Ins\Data\Notes.txt</code>
 
 
If the filename includes a path relative to the location of the VectorWorks executable, the subfolder delimiters have to be backslashes:
If the filename includes a path relative to the location of the VectorWorks executable, the subfolder delimiters have to be backslashes:


<dir>Plug-InsDataNotes.txt</dir>
<code>Plug-Ins\Data\Notes.txt</code>
 
 
If the filename does not include a path, the file is assumed to exist in the same folder as the VectorWorks executable.</desc>
If the filename does not include a path, the file is assumed to exist in the same folder as the VectorWorks executable.</desc>



Revision as of 09:39, 25 December 2017

.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix

Description

Procedure Open opens a ASCII text file for reading.

Remember to use Close when you are finished reading or writing to a file.


If the filename includes a fully qualified path, the path has to use the appropriate notation for the local operating system:

Macintosh HD:Applications:VectorWorks:Plug-Ins:Data:Notes.txt C:Program FilesVectorWorksPlug-Ins\Data\Notes.txt


If the filename includes a path relative to the location of the VectorWorks executable, the subfolder delimiters have to be backslashes:

Plug-Ins\Data\Notes.txt


If the filename does not include a path, the file is assumed to exist in the same folder as the VectorWorks executable.

PROCEDURE Open(
fileName :STRING);
def vs.Open(fileName):
    return None

Parameters

fileName STRING Name of file to open.

Remarks

Absolute paths versus relative paths:

Accepts platform specific absolute paths, or windows delimited relative paths:

Accepts platform specific absolute paths only:

Returns platform specific absolute paths (user interactive):

Returns platform specific absolute paths (not user interactive):

Example

VectorScript

PROCEDURE Example;
VAR
fileName :STRING;
BEGIN
UseDefaultFileErrorHandling(FALSE);
fileName := 'Plug-InsCommonDataCallout Prefs.txt';
Open(fileName);
AlrtDialog(Concat(GetLastFileErr));
Close(fileName);
END;
RUN(Example);

Python


Version

Availability: from All Versions