18.01.2013 Views

VBScript Reference Manual for InduSoft Web Studio

VBScript Reference Manual for InduSoft Web Studio

VBScript Reference Manual for InduSoft Web Studio

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>InduSoft</strong> <strong>Web</strong> <strong>Studio</strong> <strong>VBScript</strong> <strong>Reference</strong> <strong>Manual</strong><br />

Scripting FileSystemObject<br />

The <strong>VBScript</strong> FileSystemObject object provides access to a computer's file system<br />

FileSystemObject Methods<br />

Method Description<br />

BuildPath Appends a name to an existing path.<br />

CopyFile Copies one or more files from one location to another.<br />

CopyFolder Recursively copies a folder from one location to another.<br />

CreateFolder Creates a folder.<br />

CreateTextFile Creates a specified file name and returns a TextStream object.<br />

DeleteFile Deletes a folder and its contents.<br />

DeleteFolder Deletes a folder and its contents.<br />

DriveExists Indicates the existence of a drive.<br />

FileExists Indicates the existence of a file.<br />

FolderExists Indicates the existence of a folder.<br />

GetAbsolutePathName Returns a complete and unambiguous path from a provided path specification.<br />

GetBaseName Returns the base name of a path.<br />

GetDrive Returns a Drive object corresponding to the drive in a path<br />

GetDriveName Returns a string containing the name of the drive <strong>for</strong> a path.<br />

GetExtensionName Returns a string containing the extension <strong>for</strong> the last component in a path.<br />

GetFile Returns a File object corresponding to the file in a path.<br />

GetFileName Returns the last component of a path that is not part of the drive specification.<br />

GetFolder Returns a Folder object corresponding to the folder in a specified path.<br />

GetParentFolderName Returns a string containing the name of the parent folder of the last component in a<br />

path.<br />

GetSpecialFolder Returns the special folder requested.<br />

GetTempName Returns a randomly generated temporary file or folder name.<br />

MoveFile Moves one or more files from one location to another.<br />

MoveFolder Moves one or more folders from one location to another.<br />

OpenTextFile Opens a file and returns a TextStream object<br />

FileSystemObject Properties<br />

Properties Description<br />

Drives A Drives collection of all Drive objects available on the local machine.<br />

Collections returned by FileSystemObject method calls reflect the state of the file system when the<br />

collection was created. Changes to the file system after creation are not reflected in the collection. If the<br />

file system might be changed during the lifetime of the collection object, the method returning the<br />

collection should be called again to ensure that the contents are current.<br />

Set fs = CreateObject("Scripting.FileSystemObject")<br />

Set a = fs.CreateTextFile("c:\testfile.txt", True)<br />

a.WriteLine("This is a test.")<br />

a.Close<br />

In the code shown above, the CreateObject function returns the FileSystemObject (fs). The<br />

CreateTextFile method then creates the file as a TextStream object (a) and the <strong>VBScript</strong><br />

TextStream Object WriteLine Method writes a line of text to the created text file. The <strong>VBScript</strong><br />

TextStream Object Close Method flushes the buffer and closes the file.<br />

<strong>InduSoft</strong>, Ltd. 31

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!