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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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

Method: CreateTextFile<br />

Description: Creates a specified file name and returns a TextStream object that can be used to read from or<br />

write to the file<br />

Use: Set objfile = fso.CreateTextFile(filename[, overwrite[, Unicode]])<br />

Arguments: fso<br />

Required. The name of a FileSystemObject object previously instantiated<br />

filename<br />

Required. A string expression that identifies the file to create<br />

overwrite<br />

Optional. Boolean value that indicates whether you can overwrite an existing file. The value is<br />

True if the file can be overwritten, False if it can't be overwritten. If omitted, existing files are<br />

not overwritten (default False).<br />

unicode<br />

Optional. Boolean value that indicates whether the file is created as a Unicode or ASCII file. If<br />

the value is True, the file is created as a Unicode file. If the value is False, the file is created<br />

as an ASCII file. If omitted, an ASCII file is assumed.<br />

Remarks: None<br />

Example: Dim fso, myFile<br />

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

Set myFile = fso.CreateTextFile("c:\testfile.txt", True, False)<br />

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

myFile.Close<br />

Set Myfile = Nothing<br />

Set fso = Nothing<br />

Method: DeleteFile<br />

Description: Deletes a specified file<br />

Use: fso.DeleteFile (filename[, <strong>for</strong>ce])<br />

Arguments: fso<br />

Required. The name of a FileSystemObject object previously instantiated<br />

filename<br />

Required. The name of the file to delete. The filename can contain wildcard characters in the<br />

last path component.<br />

<strong>for</strong>ce<br />

Optional. Boolean value that is True of files with the read-only attribute set are to be deleted;<br />

False if they are not. False is the default.<br />

Return: None<br />

Remarks: An error occurs if no matching files are found. The DeleteFile method stops on the first error it<br />

encounters. No attempt is made to roll back or undo any changes that were made be<strong>for</strong>e an error<br />

occurred.<br />

Example: Dim fso, myFile<br />

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

myFile = “C:\TempData\Log*.dat”<br />

fso.DeleteFile(myFile)<br />

Set fso = Nothing<br />

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

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

Saved successfully!

Ooh no, something went wrong!