Write to files with a macro
PASSPORT PC to Host, PASSPORT Web to Host
TN3270, TN5250, VT, SCO ANSI, Wyse 60
How can I read from and write to files when writing a PASSPORT macro?
PASSPORT uses a subset of VBScript for its macro scripting language; therefore it does not recognize the VB "Open" statement. However, you can use the VBScript FileSystemObject object model to accomplish the same thing. Below is a sample PASSPORT macro that uses the FileSystemObject object model:
Sub ZMain() Dim fso, tf Set fso = CreateObject("Scripting.FileSystemObject") Set tf = fso.CreateTextFile("c:\testfile.txt", True) ' Write a line with a newline character. tf.WriteLine("Testing 1, 2, 3.") ' Write three newline characters to the file. tf.WriteBlankLines(3) ' Write a line. tf.Write ("This is a test.") tf.Close End Sub |
For additional information on the FileSystemObject object model, please refer to the following Microsoft MSDN link: http://msdn2.microsoft.com/en-us/library/d6dw7aeh(VS.85).aspx
macro, read, write, file, filesystemobject