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 />

s=f.ReadLine<br />

MsgBox s ‘Display the second line<br />

f.Close<br />

Method: Write<br />

Description: Writes a specified string to a TextStream file.<br />

Use: objTso.Write(string)<br />

Arguments: objTso<br />

Required. The name of a TextStream Object previously instantiated.<br />

string<br />

Required. The text you want to write to the file.<br />

Return: None<br />

Remarks: Specified strings are written to the file with no intervening spaces or characters between each<br />

string. Use the WriteLine method to write a newline character or a string that ends with a newline<br />

character.<br />

Example: Const ForReading=1, Const ForWriting=2, ForAppending=8<br />

Dim fso, f, myFile<br />

Set fso = CreateObject(“Scripting.FileSystemObject”) ‘Instantiate the FSO object<br />

myFile = $getAppPath() & “notes.txt” ‘Specify the app directory & file<br />

Set f = fso.OpenTextFile(myFile, ForWriting, True)<br />

f.Write “This is a new string of data” ‘Write a string<br />

Set f = fso.OpenTextFile(myFile, ForReading)<br />

MsgBox “File contents = “ & f.ReadLine ‘Display line of data<br />

f.Close<br />

Method: WriteBlankLines<br />

Description: Writes a specified number of newline characters to a TextStream file.<br />

Use: objTso.WriteBlankLines(numLines)<br />

Arguments: objTso<br />

Required. The name of a TextStream Object previously instantiated.<br />

numLines<br />

Required. The number of newline characters you want to write to the file.<br />

Return: None<br />

Remarks: None<br />

Example: Const ForReading=1, Const ForWriting=2, ForAppending=8<br />

Dim fso, f, myfile<br />

Set fso = CreateObject(“Scripting.FileSystemObject”) ‘Instantiate the FSO object<br />

myFile = $getAppPath() & “notes.txt” ‘Specify the app directory & file<br />

Set f = fso.OpenTextFile(myFile, ForWriting, True)<br />

f.WriteBlankLines(3) ‘Write 3 blank lines<br />

f.WriteLine “This is a new line of data” ‘Write data on the 4 th line<br />

f.Close<br />

Method: WriteLine<br />

Description: Writes a specified string and newline character to a TextStream file.<br />

Use: objTso.WriteLine([string])<br />

Arguments: objTso<br />

Required. The name of a TextStream Object previously instantiated.<br />

string<br />

Optional. The text you want to write to the file.<br />

Return: None<br />

Remarks: If you omit the string, a newline character is written to the file.<br />

Example: Const ForReading=1, Const ForWriting=2, ForAppending=8<br />

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

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

Saved successfully!

Ooh no, something went wrong!