I am a VFP programmer and created this script last year. This was my one and only time to use ASPECT. I'm including the pertinent blocks of script and will give a brief view of what we are doing. Files are created and sent to a folder (fWATCHDIR). We then start ProComm Plus 4.8 on Windows XP (running compatible with Windows 95) to dial a vendor, send a file, and capture the screen to a TXT file. This TXT file is then used to log the file's confirmation number or failure to be sent.
The problems that I am encountering are:
1. Hangup and/or disconnect cause the phone icon to hangup. But the app may sit for up to 2 - 3 minutes before it actually continues with the next file in the folder. I added the redundant commands when the problem was first encountered.
2. If the folder becomes empty and then files are added to it, the script stops running (the icon of the man running, actually stops moving). The user monitoring the file transfer must click the script icon to start it again.
I have searched everywhere for any insight to these problems. They are not consistent so they are very hard to determine a cause. I have the script on 5 different PCs all configured the same and the problem occurs on any one of them and any time.
I have thoroughly searched this site and have found several great ideas for enhancements that we have planned in the future. I appreciate any input ahead of time.
Thanks,
Laura
The problems that I am encountering are:
1. Hangup and/or disconnect cause the phone icon to hangup. But the app may sit for up to 2 - 3 minutes before it actually continues with the next file in the folder. I added the redundant commands when the problem was first encountered.
2. If the folder becomes empty and then files are added to it, the script stops running (the icon of the man running, actually stops moving). The user monitoring the file transfer must click the script icon to start it again.
I have searched everywhere for any insight to these problems. They are not consistent so they are very hard to determine a cause. I have the script on 5 different PCs all configured the same and the problem occurs on any one of them and any time.
I have thoroughly searched this site and have found several great ideas for enhancements that we have planned in the future. I appreciate any input ahead of time.
Thanks,
Laura
Code:
;**********************************************************
;* MACROS definitions
;**********************************************************
#define fWATCHDIR "C:\acca\kansascity7150\" ;The directory to watch for files.
#define fBACKUPDIR "C:\orders_sent\" ;The directory to move files to.
#define fLOGFILE "C:\acca\logfile.txt" ;The error/log file.
#define fPROCOMM "C:\acca\procomm.txt" ;The ProComm file.
#define szENTRY "Kansas City" ;The entry to dial.
;**********************************************************
;* Main
;**********************************************************
proc Main
string Cmd
strfmt s0 "YES"
strfmt s1 " "
when USEREXIT call Done ; Trap when user tries to exit script.
while strcmp s0 "YES"
startprocess()
endwhile
fclose 1
if isfile fPROCOMM
Cmd = "del C:\ACCA\PROCOMM.TXT" ; Set DOS command to execute.
DOS Cmd HIDDEN ; Run DOS command hidden.
endif
endproc
;**********************************************************
;* StartProcess
;**********************************************************
proc StartProcess
string szMsg, szFile
if fopen 1 fPROCOMM APPEND TEXT ; Open procomm file for read only.
fputs 1 "ProComm is running!"
else
statmsg "Error - Couldn't open the procomm file `"%s`"." fPROCOMM
;Error if not able to create procomm file.
endif
if fopen 0 fLOGFILE APPEND TEXT ; Open log file for read only.
logit("***************************************************")
strfmt szMsg ("Date: %s") $date ;Info for log file.
logit(szMsg)
strfmt szMsg ("Time: %s") $time
logit(szMsg)
logit("")
else
statmsg "Error - Couldn't open the log file `"%s`"." fLOGFILE
;Error if not able to create log file.
endif
WatchIt(&szFile) ;Watch for files.
yield
ACCA(szFile)
yield
SendIt(szFile) ;Connect and upload file to host.
yield
MoveIt(szFile) ;Move file to backup dir.
yield
logit("Done.")
endproc
;**********************************************************
;* WatchIt
;**********************************************************
proc WatchIt
param string szFile
string szDir, szMsg
szDir = fWATCHDIR
strcat szDir "*.txt"
while 1
if findfirst szDir ;Find first file matching spec.
szFile = $filespec ;Get filename.
strfmt szMsg ("File found: %s") $filespec
logit(szMsg)
exitwhile
endif
strfmt s0 "NO"
endwhile
endproc
;**********************************************************
;* SendIt *
;**********************************************************
proc SendIt
param string szFile
string thestring
integer Row,iTemp ;,iNum
set dial retries 3 ;Set dial retries to 3.
if strncmp s1 "0" 1
dial DATA szENTRY ;Dial the host system.
while $dialing ;Loop while dialing.
endwhile
else
if strncmp s1 "2" 1
dial DATA szENTRY ;Dial the host system.
while $dialing ;Loop while dialing.
endwhile
else
if strncmp s1 "3" 1
dial DATA szENTRY ;Dial the host system.
while $dialing ;Loop while dialing.
endwhile
else
if strncmp s1 "4" 1
dial DATA szENTRY ;Dial the host system.
while $dialing ;Loop while dialing.
endwhile
else
logit("Problems with store number.")
endif
endif
endif
endif
if $carrier ;Check to see if connected.
if strncmp s1 "0" 1
waitfor "Username: "
transmit "7150^M"
waitfor "Password: "
transmit "KLEVINE^M"
logit("Username: 7150")
logit("Password: KLEVINE")
else
if strncmp s1 "2" 1
waitfor "Username: "
transmit "2146^M"
waitfor "Password: "
transmit "LEVINE^M"
logit("Username: 2146")
logit("Password: LEVINE")
else
if strncmp s1 "3" 1
waitfor "Username: "
transmit "3900^M"
waitfor "Password: "
transmit "MLEVINE^M"
logit("Username: 3900")
logit("Password: MLEVINE")
else
if strncmp s1 "4" 1
waitfor "Username: "
transmit "7701^M"
waitfor "Password: "
transmit "LEVINE^M"
logit("Username: 7701")
logit("Password: LEVINE")
endif
endif
endif
endif
waitfor "Please start your upload now."
iTemp = 1 ;Set iTemp value to 1 (for loop.)
sendfile XMODEM szFile ;Upload file using XMODEM.
while iTemp == 1 ;While file transfer is going on.
iTemp = $XFERSTATUS ;Store value in $XFERSTATUS in iTemp
yield ;Yield processor time.
endwhile
for Row = 0 upto 24 ; Loop through each row on screen.
termgets Row 0 thestring 79 ; Get line specified by row.
if strcmp thestring "Press any key to end this call."
disconnect
hangup
exitfor
endif
Logit(thestring) ; Write line from screen to file.
endfor
disconnect ;Hangup from host.
yield
else ;If not connected log error.
logit("Problems connecting to host system.")
endif
endproc
;**********************************************************