home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CICA 1995 May
/
cica_0595_4.zip
/
cica_0595_4
/
UTIL
/
ENHPCP1
/
FTPTRY.WAS
< prev
next >
Wrap
Text File
|
1992-12-01
|
5KB
|
142 lines
;"FtpTry" - Script to auto-login to an ftp site
;You should read it this script through before using it, because there may be a couple
;of things you need to change (there's at least one that you *must* change).
;This script is designed to log you in to busy sites, not shut-down ones. This
;script assumes that a connection can be established, but that you're getting a
;"busy signal" of some kind.
;please send any comments, suggestions, complaints, praises, donations (haha) to
;Erick Hammersmark, ehammers@u.washington.edu
string FtpSite,FtpSiteTwo,FtpDir,SiteFile = "c:\prowin\sites.txt"
integer UseDir = 1
proc main
call GetSite ;call the site input dialog box
call ReCall ;call the site
when target 0 "530" call QuitFtp ;if busy quit and try again
when target 1 "):" call Login ;if faced with login prompt, login
when target 2 "230" call EndFtp ;if logged in, end script
while 1
endwhile
endproc
proc ReCall ;procedure to call an ftp site
transmit "ftp "
transmit Ftpsite
transmit "^M"
endproc
proc QuitFtp ;procedure to quit and try again
transmit "quit^M" ;quit
waitfor "%" ;waitfor prompt
call ReCall ;try again
endproc
proc EndFtp ;procedure to call when logged in
if Usedir ;if "Use working directory" box checked
waitfor "ftp>" ;waitfor prompt
call GetWorkDir ;call procedure to get working directory
transmit "cd "
transmit FtpDir
transmit "^M" ;cd to working directory
waitfor "ftp>" ;waitfor prompt
endif
alarm 2 ;if you have a sound card, this line could be changed to:
exit ;mciexec "sound c:\sound\atten.wav", where "c:\sound\atten.wav"
endproc ;is the path and filename of your favorite sound.
proc Login ;procedure to login to ftp site
pause 1 ;make sure site is ready
transmit "anonymous^M"
waitfor "Password:"
pause 1
transmit "ehammers@u.washington.edu^M" ;please change this to your own e-mail address!
endproc
proc GetSite ;procedure to input ftp site
integer selection = 0
FtpSite = "ftp.cica.indiana.edu" ;default site - change as desired
call GetWorkDir ;call procedure to get working directory from file
UseDir = 1 ;UseDir check box on by default
dialogbox 109 40 163 102 2 "What site?"
pushbutton 28 62 40 14 "OK" normal default
pushbutton 94 62 40 14 "Cancel" cancel
pushbutton 61 82 40 14 "Manual" normal
fcombobox 16 11 131 53 SiteFile FtpSite sort
checkbox 38 28 81 10 "Use Working Directory" UseDir
vtext 71 44 86 11 left FtpDir
text 12 44 59 11 left "Working Directory:"
enddialog
while 1
selection = $DIALOG
if selection == 190 ;if fcombobox item is selected
call GetWorkDir ;get new working directory
updatedlg 64 ;update vtext
endif
if selection == 1 ;if cancel is pressed
exit
endif
if selection == 10 ;if OK is pressed
exitwhile
endif
if selection == 11 ;if Manula is pressed
call Manually ;call procedure to manually enter site
exitwhile
endif
endwhile
endproc
proc GetWorkDir ;procedure to get working dir from file
fopen 0 "c:\prowin\sitedirs.txt" READWRITE TEXT ;open data file
while 1
fgets 0 FtpSiteTwo ;get new site
fgets 0 FtpDir ;get new dir
strcmp FtpSiteTwo FtpSite
if success ;if new site matches fcombobox selection
exitwhile ;exit loop
endif
endwhile
fclose 0
endproc
proc Manually ;procedure to manually enter site name, and possibly add it to the list
integer selection = 0
dialogbox 112 35 203 95 2 "Manual Entry"
editbox 44 12 144 12 FtpSite
pushbutton 36 50 40 14 "OK" normal
pushbutton 116 50 40 14 "Cancel" cancel
pushbutton 76 72 40 14 "Add to List" normal
text 6 14 30 8 left "FTP Site:"
editbox 44 30 144 12 FtpDir
text 3 31 39 10 left "Working Dir:"
enddialog
while 1
selection = $DIALOG
if selection == 10 ;of OK is pressed
exitwhile
endif
if selection == 1 ;if Cancel is pressed
exit
endif
if selection == 11 ;if Add to List is pressed
call AddToList ;call procedure to add site and working dir to data files
exitwhile
endif
endwhile
endproc
proc AddToList ;procedure to add site and working dir to data files
fopen 0 "c:\prowin\sites.txt" READWRITE TEXT ;site data file
fseek 0 0 2 ;go to end of file
fputs 0 FtpSite ;write new site
fclose 0 ;close site data file
fopen 0 "c:\prowin\sitedirs.txt" READWRITE TEXT ;dir data file
fseek 0 0 2 ;go to end of file
fputs 0 FtpSite ;write new site
fputs 0 FtpDir ;write new dir
fclose 0 ;close dir data file
endproc