Hi everybody!
I am a newbie for the ProComm/ASPECT script programming. And there is not much documentation available for ASPECT so I am totally stuck with this issue. -
I need to feed some line items to an ERP system thru screen scraping. These line items are stored in a comma delimited file. So far I have been able to connect/Logon to the remote system, open and read the file data.
The problem is the "waitfor" commands in the script to jump from the column1 to column 2 etc. I need to perform this column-to-column cursor jump in a loop (for each line in the file) and hence the parameters in the waitfor command should be dynamic. IS this possble to do? if not, what's the best way to accomplish this task?
===============
here's my sample script:
; variable declartion
string fileNm = "C:\myappln\test.req"
;Login to the remote system
connect TELNET "remote machineA"
waitfor "login: "
transmit "uid^M"
waitfor "password: "
transmit "pwd^M"
if fopen 0 fileNm READ TEXT ; Open file for read only
while not feof 0 ; Loop while not end of file
; get data from the file
fgets 0 LineBuffer ; Get line from file
strtok LineNum LineBuffer "," 1 ; Get the Line #
strtok EmpNum LineBuffer "," 1 ; Get EmployeeID
strtok Dept LineBuffer "," 1 ; Get Dept#
strtok phoneNo LineBuffer "," 1 ; Get phone#
; REM -- Strip out the quotes
strreplace LineNum "`"" ""
strreplace EmpNum "`"" ""
strreplace Dept "`"" ""
strreplace phoneNo "`"" ""
transmit EmpNum
transmit "^M"
waitfor "^[[4;16H"
transmit Dept
transmit "^M"
waitfor "^[[4;22H"
transmit phoneNo
transmit "^M"
endwhile
endif
endproc
===============
As you can see in the above script, the waitfor command has the following cursor's co-ordinates which would vary per each line. (in partcular the line posn i.e for the next line it shud be: waitfor "^[[5;16H" )
When I run this script, the after reading the first line, on the next line the command goes into the default wait period and then reads the string. This is way slow; for the input file has 100s of lines to be fed into the remote system.
Any help would be greatly appreciated.
Thanks so much for reading this long mail
newmem
I am a newbie for the ProComm/ASPECT script programming. And there is not much documentation available for ASPECT so I am totally stuck with this issue. -
I need to feed some line items to an ERP system thru screen scraping. These line items are stored in a comma delimited file. So far I have been able to connect/Logon to the remote system, open and read the file data.
The problem is the "waitfor" commands in the script to jump from the column1 to column 2 etc. I need to perform this column-to-column cursor jump in a loop (for each line in the file) and hence the parameters in the waitfor command should be dynamic. IS this possble to do? if not, what's the best way to accomplish this task?
===============
here's my sample script:
; variable declartion
string fileNm = "C:\myappln\test.req"
;Login to the remote system
connect TELNET "remote machineA"
waitfor "login: "
transmit "uid^M"
waitfor "password: "
transmit "pwd^M"
if fopen 0 fileNm READ TEXT ; Open file for read only
while not feof 0 ; Loop while not end of file
; get data from the file
fgets 0 LineBuffer ; Get line from file
strtok LineNum LineBuffer "," 1 ; Get the Line #
strtok EmpNum LineBuffer "," 1 ; Get EmployeeID
strtok Dept LineBuffer "," 1 ; Get Dept#
strtok phoneNo LineBuffer "," 1 ; Get phone#
; REM -- Strip out the quotes
strreplace LineNum "`"" ""
strreplace EmpNum "`"" ""
strreplace Dept "`"" ""
strreplace phoneNo "`"" ""
transmit EmpNum
transmit "^M"
waitfor "^[[4;16H"
transmit Dept
transmit "^M"
waitfor "^[[4;22H"
transmit phoneNo
transmit "^M"
endwhile
endif
endproc
===============
As you can see in the above script, the waitfor command has the following cursor's co-ordinates which would vary per each line. (in partcular the line posn i.e for the next line it shud be: waitfor "^[[5;16H" )
When I run this script, the after reading the first line, on the next line the command goes into the default wait period and then reads the string. This is way slow; for the input file has 100s of lines to be fed into the remote system.
Any help would be greatly appreciated.
Thanks so much for reading this long mail
newmem