I nned help. I am trying to be able take a list of numbers and dial them one at a time, once connected send a file, decompress it and then move on to the next number in the list. Any help on getting started would be appreciated.
Are the numbers in your Connection Directory or in a file that you are referencing? If the numbers are in the Connection Directory, then you should be able to use the dial command with the CONNECTALL flag. I say should because I think I had heard of someone having a problem doing this once before, but I may be remembering incorrectly and am not a machine where I can test this at the moment.
If the numbers are in a file, then you would use the fopen command to open the text file and fgets to read data from the file.
Once you have a connection made to the first number, you would then begin the necessary steps with the remote system. The best way to do this for all numbers would be to place all commands in a while loop (while not feof in the case of the numbers coming from a text file).
yes the numbers are in a text file. Can you please give me an example of code on how to use the fopen and fgets to open and read the file and then dial the number ? Any help with that would be great.
if fopen 0 "data.txt" READ TEXT
while not feof 0
if not nullstr sNum
fgets 0 sNum
dial DATA sNum
while $DIALING
yield
endwhile
if $CARRIER
;perform operations here once connected...
endif
endif
endwhile
endif
endproc
Unless you specify a path in the fopen command, the file containing the phone numbers (data.txt in this example) must be located in your ASPECT directory.
I tried this code and all it does is bring up a procomm window and just sits there at OK. The running man is still moving like the script is running but nothing happens. I do have the file data.txt in the procomm DIR and it contains for now 3 phone numbers. Is there something I am doing wrong.
Did you run my script as posted or did you make the necessary modifications at the ;perform operations here once connected... line? If not, then all the script will do is dial one number after another, but not send any information or commands to the remote system.
Ah, I see the problem now, try this (I had two lines flipped):
proc main
string sNum
if fopen 0 "data.txt" READ TEXT
while not feof 0
fgets 0 sNum
if not nullstr sNum
dial DATA sNum
while $DIALING
yield
endwhile
if $CARRIER
;perform operations here once connected...
endif
endif
endwhile
endif
fclose 0
endproc
now I have another problem, some of the numbers I am dialing I have to connect at a different baudrate. Is there a way to get the baudrate from the same file and set the baudrate from that each time I dial a number ?
I'm not at a machine with a modem so I can't test this, but I believe the only way to set the baud rate is if you are using modem command mode (Data | Modem Command Mode menu item) and use the set port baudrate command. I take it that the numbers you are dialing are in the text file and not in the Connection Directory? If they were in the Connection Directory, then you could set a different speed for each entry.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.