Capturing Text in a Host File Then Importing into PC File
PASSPORT PC to Host, PASSPORT Web to Host
TN3270, TN5250, VT, SCO ANSI, Wyse 60
How can I capture text information in a host file then import it into a PC file?
The sample PASSPORT macro (.zmc) below demonstrates this process. In order for this to work, you will need FTP running on your host. The example also uses a standard User ID (with FTP access) and Host IP Address. You will need to modify these to work correctly in your environment.
Sub ZMain() FTPGetFile End Sub
Sub FTPGetFile Dim fso Dim ws Dim FTPFile Dim open_file Dim strPasswd Dim strPCFile Dim strHostFile
strPasswd = MsgBoxGetPassword("Please enter your password") strHostFile = MsgBoxGetInput("Please enter the Host file name") strPCFile = MsgBoxGetInput("Please enter the PC file name with full path, e.g. c:\readme.txt") set fso = CreateObject("Scripting.FileSystemObject") Set ws = CreateObject("WScript.Shell") 'Open file with 2(write) initializes the file and erases any existing data FTPFile = "c:\script.ftp" if fso.FileExists(FTPFile) then set open_file = fso.OpenTextFile(FTPFile, 2) else set open_file = fso.OpenTextFile(FTPFile, 2, "True") end if
open_file.WriteLine "open 172.16.0.1" open_file.WriteLine "testID" open_file.WriteLine strPasswd open_file.WriteLine "ascii" open_file.WriteLine "get " & strHostFile & " " & strPCFile open_file.WriteLine "bye" open_file.Close ws.Run "FTP -s:c:\script.ftp", 1, True fso.DeleteFile FTPFile, "True" End Sub |
macro, capture, text, host, import, file