VS:Rewrite

From Vectorworks Developer
Revision as of 14:36, 12 August 2013 by Root (talk | contribs) (1 revision)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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

Description

Procedure Rewrite creates a new ASCII text file or opens an existing one prior to writing data to the file. If the file exists, new data written to the file will overwrite any data currently within the 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-InsDataNotes.txt

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

Plug-InsDataNotes.txt

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

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

Parameters

fileName STRING Name of file.

Example

VectorScript

PROCEDURE Example;
VAR
    fileName :STRING; 
    major, minor, maintenance, platform :INTEGER;
BEGIN
    GetVersion(major, minor, maintenance, platform);
    IF platform = 1 THEN BEGIN
        fileName := '/Example.txt';
    END ELSE BEGIN
        fileName := 'C:Example.txt';
    END;
    ReWrite(fileName);
    WriteLn('example text');
    Close(fileName);
END;
RUN(Example);

Python


Version

Availability: from All Versions