PASSPORT Knowledge Base
Macros

Date Published: June 24, 2004
Date Updated: March 10, 2008

Title

Write to files with a macro

Product

PASSPORT PC to Host, PASSPORT Web to Host

Emulation Types

TN3270, TN5250, VT, SCO ANSI, Wyse 60

Issue

How can I read from and write to files when writing a PASSPORT macro?

Solution

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

 

 

More Information

Keywords

macro, read, write, file, filesystemobject