WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

FTP Functions

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

How to Pass Variables to a FTP Script

Keywords: FTP Winsock	

Question:

;open 999.999.999.9
;%USERNAME%
;%PASSWORD%
;get 'lz.ag100r.p050.h01' ;H:\entrpris\hyperion\mgtrpt5\inbox\stat\%FNAME%.TXT
;close
;bye
I would like to pass variables to this sample FTP script file. Or is there a better way to accomplish this task? I've tried sending keystrokes to the window but I was having problems testing for the completion of each download. I am attempting to download 4 files each evening. The RunWait command works perfectly but I need a way for the user to enter his/her own ID & Password.

When I use the SendKey, I can get as far as the download, but i'm having trouble delaying the winbatch until the file is down. I've used FileExist but it doesn't seem to delay.

Answer:

The OPEN statement shows you are going through some kind of firewall. You can use our 32 bit Internet extender that understands firewalls, so you can do ftp directly from Winbatch. Here's the solution:
sTitle = "MAINFTP PGM"
AddExtender("WWWSK34I.dll")

Hostaddr="999.999.999.9"
Host=Addr2Host(HostAddr)

Message(Host,HostAddr)

UserID="MyName"
Password="MyPassword"
Acct=""

FtpFireWall(3,HOST,"FTP",UserID,Password)

hSession=FtpOpen(HOST,UserID,Password,Acct,1)
if !isNumber(hSession)
        Message("FTP OPEN ERROR",hSession)
      exit
endif

rs=FTPGet(hsession,'lz.ag999r.p999.h99',"h:\entrpris\hyperion\mgtrpt5;\inbox\stat\fb97st.txt")

FtpClose(hSession)

Message("FTPGet returned",rs)

Article ID:   W12648
Filename:   How to Pass Variables to FTP Script.txt
File Created: 2001:03:01:15:09:18
Last Updated: 2001:03:01:15:09:18