Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading commands from file

Status
Not open for further replies.

bitbucketz

Programmer
Jul 13, 2006
3
US
Hello All -

I am trying to read a series of tab seperated commands from a text file into an aspect script. I have read through most of the postings here and at aspectscripting.com and come up with the following script. It compiles fine but when run never dials the modem. I am running Procomm Plus 4.8 on Win2k Professional. Does anyone see an obvious errors here?

Thnx,

WC

proc main
string sLine, sVendorID, sDealerID, sPullType, sNum, sLoginName, SLoginPass, sAcctString1, sAcctString2, sAcctString3

fopen 0 "diallist.txt" READ TEXT ;Open the data file
while not feof 0 ;While the file still has data
fgets 0 sLine ;Read a line of data
strtok sVendorID sLine "`t" 1 ;Get the first tab delimited field
strtok sDealerID sLine "`t" 1 ;Get the second tab delimited field
strtok sPullType sLine "`t" 1 ;Get the third tab delimited field
strtok sNum sLine "`t" 1 ;Get the fourth tab delimited field
strtok sLoginName sLine "`t" 1 ;Get the fifth tab delimited field
strtok SLoginPass sLine "`t" 1 ;Get the sixth tab delimited field
strtok sAcctString1 sLine "`t" 1 ;Get the seventh tab delimited field
strtok sAcctString2 sLine "`t" 1 ;Get the eighth tab delimited field
strtok sAcctString3 sLine "`t" 1 ;Get the nineth tab delimited field
if not nullstr sNum ;If entry is not blank
dial DATA sNum ;Then dial it
while $DIALING ;Pause while dialing
yield
endwhile
if $CARRIER ;If connected...
waitfor "CONNECT" 90
transmit "hel menu^M"
waitfor "TERMINAL" 30
transmit "^M"
waitfor "USER ID" 30
transmit sLoginName
transmit "^M"
transmit sLoginPass
transmit "^M"
waitfor "SELECTION" 30
if not nullstr sAcctString1 ;If entry is not blank
transmit sAcctString1
transmit "^M"
endif
if not nullstr sAcctString2 ;If entry is not blank
transmit sAcctString2
transmit "^M"
endif
if not nullstr sAcctString3 ;If entry is not blank
transmit sAcctString3
transmit "^M"
endif
transmit "6910^M" ;go to reports menu
endif
endif
endwhile
fclose 0
endproc
 
Nothing jumps out at me in the script. You might try adding:

usermsg "X%sX" sNum

prior to dialing to see if sNum has the value you are expecting in it. The X characters in the usermsg command will help you spot if there are any whitespace characters in the string that may be causing problems.

 
Hey Knob --

Thnx for the tip - very helpful, but it is returning the expected data. I thought perhaps the platform was the problem so I found an oul copy of Win98 and installed it. Same results - the script just loops through all the entries in the text file without actually dialing the numbers.

Any other clues?
 
FYI ... Found a solution.
Changed the command to: dialnumber DATA sNum
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top