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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Download Script

Status
Not open for further replies.

jlkpal

Programmer
Sep 10, 2005
14
US
I've been spinning my wheels trying to create a download script. The GETFILE ZMODEM command just doesn't seem to compile.

Does anyone have a sample script to download a file? Unfortunately, I wasn't able to get the Aspect Script sample cds, which may have some good examples of the download...

Thanks in advance!
 
More information -

I was able to get the script to compile, however, it won't transfer the file. The Transfer box appears but times out. On the host side, I do have the data in the correct directory.

transmit "D test.mdb^M"
waitfor "Start Xfer"
getfile ZMODEM
while $XFERSTATUS
yield
endwhile

As a side note, I am able to send files, using a different script, but not get files. Of course, I tried using my "send" script and modified it to "get" the data.

Thanks again...
 
Try taking a look at a couple of the download scripts on the samples page of my site (link below). The example in the help file is not the best regarding the while $XFERSTATUS loop.


 
Thanks for the info. I've tried several variations of downloading the file. The connection is made, but the download still doesn't occur.

Any help would be greatly appreciated...

;>>>>>>>>>>>>>>>>>>>>>>>>
#define fLOGFILE "C:BACKUP\logfile.txt"
#define szENTRY "Downtown"

proc Main

startprocess()
endproc

proc StartProcess
string szMsg
string sLoss = "NO CARRIER or LOST"
if fopen 0 fLOGFILE APPEND TEXT
Logit
strfmt szMsg ("Date: %s") $date
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

yield

set dial retries 3
dial DATA szENTRY
while $dialing
yield
endwhile
pause 2

While $CARRIER
logit("Connected to host system.")
yield

when $XFERSTATUS call getit

while 1
yield
endwhile

hangup
pause 2
yield

if $CARRIER == 0 ;* Lost Carrier
logit("Problems connecting to host system.")
Errormsg sLoss ;* Inform User
exit
endif

logit("Done.")
pwexit
endwhile
endproc

proc getit
integer iStatus
string sDownloadFile = "TEST.mdb"
iStatus = $XFERSTATUS
while iStatus == 1
if nullstr sDownloadFile
sDownloadFile = $XFERFILE
endif
iStatus = $XFERSTATUS
endwhile
if iStatus == 2
;Transfer successful, continue with script execution
elseif iStatus == 3
;Transfer failed, perform error handling
endif
endproc

proc LogIT
param string szMsg

fputs 0 szMsg ;output to logfile.
endproc



 
With the script posted above, are you still seeing it timeout and not start the transfer? If so, try removing the when $XFERSTATUS command and replace it with getfile ZMODEM followed by getit() to call the procedure. What I think may be happening is that the getit procedure is getting called a second time before it is done since $XFERSTATUS will change value and cause getit to be called a second time once the transfer is complete.

You might also try adding a yield command right after while iStatus == 1 in the getit procedure.

 
Thanks for the info. I received the following message based on GETFILE ZMODEM getit()

Unexpected token(s) at end of line: GETIT...

The getit procedure is as follows:

proc getit
integer iStatus
string sDownloadFile = "test.mdb"
iStatus = $XFERSTATUS
while iStatus == 1
YIELD
if nullstr sDownloadFile
sDownloadFile = $XFERFILE
endif
iStatus = $XFERSTATUS
endwhile
if iStatus == 2
;Transfer successful, continue with script execution
elseif iStatus == 3
;Transfer failed, perform error handling
endif
endproc

Any thoughts?

Thanks again...
 
Thanks again for all your help. The script compiled and I'm able to dial into the system. The ZMODEM Receiving window appears but then a timeout occurs.

 
More info - The timeout appears to happen during the endwhile after the Getfile and Getit commands.
 
Has anyone had problems with the $XFERSTATUS or $XFERFILE? The file still won't download and the $XFERSTATUS shows NULL and the XFERFILE isn't being set. I'm working with version 4.7. Am I missing something???
 
Try using this test script and see how it works for you. It's pretty much the same as what I think your script is, just minus some of the parts that I didn't need when testing on another system. You should see the Zmodem transfer dialog pop up, then after the transfer is done either the message "yes" (if successful) or "no" (if not).

proc main
While $CARRIER
yield

when $XFERSTATUS call getit

while 1
yield
endwhile
endwhile
endproc

proc getit
integer iStatus
string sDownloadFile = "test.mdb"
iStatus = $XFERSTATUS
while iStatus == 1
YIELD
if nullstr sDownloadFile
sDownloadFile = $XFERFILE
endif
iStatus = $XFERSTATUS
endwhile
if iStatus == 2
;Transfer successful, continue with script execution
pause 3
usermsg "yes"
elseif iStatus == 3
;Transfer failed, perform error handling
pause 3
usermsg "no"
endif
endproc

 
The Zmodem transfer dialog doesn't appear and it seems to hang during

While 1
yield
Endwhile

after the

When $XFERSTATUS call getit

Since I couldn't get it to work, I tested the values in Main and Getit. It never made it to Getit and didn't display any values.

Could it be a configuration problem? I am able to send files, just not receive them...

Thanks again for your help.
 
When I connect and try to Receive the file, the Zmodem dialog box appears, with no files. Does the Host have to Send while I Receive the file?
 
Are you telling the host to send the file by transmitting the proper command (download, send file, etc.)? With Zmodem, the transfer should start automatically when the host starts sending on its end, so it sounds like the transfer is not being initiated.

 
I have 2 PC's. PC#1 is trying to get information from PC#2. PC#1 has the script running to Get the file. PC#2 is set to auto answer within Procomm and have the ZMODEM download automatically set. Does PC#2 need to run something to Send the file? PC#2 is unattended.

Thanks so much for your help!
 
Yes, PC #2 will need to have a script that waits for the machine on PC #1 to send a string (say "download" or something similar), then when that string is received (you can use the waitfor or when target command to detect this) the file is sent. You might find it easier to run the host script on PC #2 so that its mini-BBS can be logged into and the necessary file(s) sent by the user on PC #1.


 
Ultimately, we will have 20 PC's dialing into the Host. Each PC will need to download a different file. Do you know of a sample script for the Host PC that would accommodate different PC's and files?

 
It works! I copied sample FileXfer_Client and FileXfer_Host files, tweaked them and they work beautifully!!!

Knob - Thanks so much for your invaluable help!!!

 
were you able to get the downloaded file to rename? i can get it to download using knobs test script but it comes through with the original filename and only into the default directory.

dang! that xmodem was so much easier. i was able to rename the file and dump it to the directory of my choosing. unfortunately this insurance company requires either zmodem or kermit and i can't rename or redirect the download.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top