---------------------------------------------------
1st exe to access terminal and capture file
integer active = 1
integer timelimit = 60
proc main
when $ERRORNUM call ErrorHandle
when QUIET timelimit call NoActivity
when ELAPSED 0 timelimit call TimedOut
when TARGET 1 "INVALID LOG-ON ATTEMPT PLEASE RETRY" call NoProgress
sendkey ALT 'D'
sendvkey 0x09
sendvkey 0x09
sendvkey 0x09
sendvkey 0x0D
waitfor "Procomm Plus Ready!^M^J"
transmit "^M~~^M"
waitfor "Host Name: "
transmit "xxxx^M"
waitfor "CUSTOMER ID: "
transmit "xxxx^M"
waitfor "CUSTOMER PASSWORD: "
transmit "xxxx^M"
waitfor "OPERATOR ID: "
transmit "xxxx^M"
waitfor "OPERATOR PASSWORD: "
transmit "xxxx^M"
waitfor "DESIRED SERVICE: "
transmit "xxxx^M"
waitfor "READY INPUT DEVICE - ENTER A CARRIAGE RETURN TO BEGIN REPORT "
clear
capture on
transmit "^M"
waitfor "DESIRED SERVICE: "
capture off
transmit "bye^M"
disconnect
while active
yield
if !$CARRIER
NoActivity()
endif
endwhile
endproc
proc ErrorHandle
active = 0
when clear
;usermsg "Processing error: %i" $ERRORNUM
pwexit
endproc
proc NoActivity
active = 0
when clear
;usermsg "There has been no activity for %i seconds." timelimit
pwexit
endproc
proc TimedOut
active = 0
when clear
;usermsg "Session time limit of %i seconds has elasped." timelimit
pwexit
endproc
proc NoProgress
active = 0
when clear
;usermsg "Your connection has been refused."
pwexit
endproc
--------------------------------------------------
2nd exe to check file, verify if file is corrupted or completed. set flag file for error, success or no record found in captured file.
string Flagerror ="C:\Program Files\Symantec\Procomm Plus\Aspect\Capture\Flagerr.txt"
string Flagsuccess ="C:\Program Files\Symantec\Procomm Plus\Aspect\Capture\Flagsuc.txt"
string File1 ="C:\Program Files\Symantec\Procomm Plus\Aspect\Capture\capture.txt"
string CopyFile2 ="C:\Program Files\Symantec\Procomm Plus\Aspect\Capture\pdr.txt"
string Flagnullrecord ="C:\Program Files\Symantec\Procomm Plus\Aspect\Capture\Flagnull.txt"
string LineToCopy
string LineCopy
string sTok1
string sTok2
integer iCount = 0
integer totalRecord
integer numOf99 = 0
integer acount = 0
integer check = 0
proc main
if isfile File1
fopen 1 File1 read text
fopen 2 CopyFile2 create text
while not feof 1
fgets 1 LineToCopy
LineCopy = LineToCopy
strtok sTok1 LineToCopy "," 1
if strfind sTok1 "01"
fputs 2 LineCopy
iCount++
endif
if strfind sTok1 "02"
fputs 2 LineCopy
iCount++
endif
if strfind sTok1 "03"
fputs 2 LineCopy
iCount++
endif
if strfind sTok1 "88"
fputs 2 LineCopy
iCount++
endif
if strfind sTok1 "16"
fputs 2 LineCopy
acount++
iCount++
endif
if strfind sTok1 "49"
fputs 2 LineCopy
iCount++
endif
if strfind sTok1 "98"
fputs 2 LineCopy
iCount++
endif
if strfind sTok1 "99"
fputs 2 LineCopy
numOf99++
iCount++
strtok sTok2 LineToCopy "," 3
atoi sTok2 totalRecord
endif
endwhile
fclose 2
fclose 1
else
Errorflag()
endif
if iCount == totalRecord && numOf99 != 0 && acount != 0
fopen 3 Flagsuccess create text
fputs 3 sTok2
fclose 3
elseif iCount == totalRecord && numOf99 != 0 && acount == 0
fopen 5 Flagnullrecord create text
fclose 5
else
Errorflag()
endif
pwexit
endproc
proc Errorflag
fopen 6 Flagerror create text
fputs 6 sTok2
fclose 6
endproc
----------------------------------------------------------
Here is what i have and it's working fine with the helps from this forum(thank you) and the 720 pages menu. Basically, File is captured from terminal from 1st exe,trimed to eliminated all junk screen prints, created flag file accordingly from captured file.
the batch file will
1) delete all file, including the flag
delay
2) exe script to access terminal,capture file
delay
3) exe 2nd script to validate capture file, set flagfile
delay
4) condition to exe steps depend on flagfile
the flagerr.txt is to call the batch file again if download not completed or corruptted file or earlier termination due to error from 1st exe.
ps, i used sendkey to call the connection direcotry , sounds funny but is the only way i know how to get it to work.
more detail, the final capture file is
.................................
01,xxx,xxx,030327,1428,012,80,1,2/
02,xxx,xxx,1,030326,1428,USD,1/
03,xxxx,USD,15,2141,,Z,20,1100,,Z,25,400,,Z,40,2141,,Z,45,2141,,Z,50/
16,xx,333,33444,/
88,1100,,Z,55,400,,Z,72,0,,Z,74,0,,Z,75,0,,Z,100,0,0,Z,182,0,,Z,400,0,0,Z,482/
88,0,,Z/
49,9423,4/
98,9423,1,6/
99,9423,1,8/
............................
if record 16 not there, flagnull is set
if total record last item from string 99 not equal to count from 01-99, file not completed, flagerr is set
else
flagsuc is set
----------------------------
everthing seems to works fairly well, i'm just concerning if no dial tone or can't get the connection, how to get the procomm session off. so the 2nd exe can be exe.
thx again