Skip to content

Latest commit

 

History

History
103 lines (83 loc) · 2.32 KB

File metadata and controls

103 lines (83 loc) · 2.32 KB

Open

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 Files\VectorWorks\Plug-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

Name Type Description
fileName STRING Name of file to open.

Remarks

Absolute paths versus relative paths:

Accepts platform specific absolute paths, or windows delimited relative paths: *Append *Close *EOF *Open *Rewrite

Accepts platform specific absolute paths only: *CreateFolder *GetFilesInFolder *GetFolder

Returns platform specific absolute paths (user interactive): *GetFile *GetFileN *PutFile

Returns platform specific absolute paths (not user interactive): *GetFolderPath *GetFPathName

Examples

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

ELSE BEGIN
	dataFile := Concat (folderPath, kFileName);
	sizeNotFound := TRUE;
	Open (datafile);
	ReadLn (dataUPI);

	else BEGIN
		getData := TRUE;
		fileName := Concat( folderPath, fileName );
		Open( fileName );
		ReadLn( gUPI_data );
{
message( ' #### gBoltType = ',gBoltType ,'   nominalSize  = ',nominalSize );
}

BEGIN
	Open (dataFile);
	ReadLn (dataUPI);
vs.Open('file.txt')

Version

Availability: from All Versions

Category