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!

Dealing with variable number of downloads

Status
Not open for further replies.

bubarooni

Technical User
May 13, 2001
506
US
I have a script that is downloading files off a server. Right now the script downloads one file and then I have to rerun it to check of more files. I would love to figure out a way to make it download over and over until the server responds 'no file available'.

I figure there has got to be a way to put a loop in there somehow. As long as I don't receive that 'no file available' back I want to put a "D^M" in there to download another file. Once it's downloaded a file I get back a '[ ]' where the "D^M" goes in. If i try and download a file and there is no available file i get the 'no file available' response. so something like??????

do while serverresponse <> 'no file available'
"D^M"
loop

hangup

Any ideas will be greatly appreicated. below is the current procedure.



Code:
proc downloadit
integer iStatus

;DIAL:
   DIALNUMBER DATA "9,99999999999"                   ; dial phone number
   PAUSE	10
   TRANSMIT	"@D^M"
   PAUSE	10
   WAITFOR	"TERMINAL="
   TRANSMIT 	"D1^M"
   WAITFOR	"@"
   TRANSMIT	"xxxx1^M"
   WAITFOR	"Production or Test (P/T)?"
   TRANSMIT	"P^M"
   WAITFOR	"Is this correct? (YES or NO)"
   TRANSMIT	"YES^M"

   WAITFOR	"Logon ID:[      ]"
   TRANSMIT	"xxxxxxxx^M"
   WAITFOR	"Password:[      ]"
   TRANSMIT	"xxxxxxxx^M"
   WAITFOR	"D)ownload U)pload G)oodbye:[]"
   TRANSMIT	"D^M"
   WAITFOR	"Payer or Submitter/Provider: (P/S)[]"
   TRANSMIT	"S^M"
   WAITFOR	"Transaction Type: []"
   TRANSMIT	"MCDS^M"
   WAITFOR	"K)ermit"
   PAUSE	2
   TRANSMIT	"Z^M"
   WAITFOR	"D)ownload    U)pload   G)oodbye"
   TRANSMIT	"G^M"	
     
   hangup                     ; Hang up the phone line.

endproc
 
I take it these are Zmodem downloads since I don't see much in the way of the usual code you would see with a download in a script?

Looks to me like the easiest thing to do would be to put a while 1 statement before the first WAITFOR "D)ownload U)pload G)oodbye:[]" line and place an endwhile after TRANSMIT "Z^M". I would then at the begining of the script at this line:

when target 0 "message" call logout

Where message is the prompt that is displayed when all files have been downloaded. When that occurs, the logout procedure (more below) will be called.

You can then remove the last waitfor command in your script, remove the last two lines from the main proc, and add this after your endproc statement:

proc logout
TRANSMIT "G^M"

hangup ; Hang up the phone line.
endproc

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top