;FTPRETRY.WAS v1.0 Retries a busy FTP site until connection is made. ;***************************************************************************** ;* * ;* FTPRETRY.WAS * ;* Copyright (C) 1996 Datastorm Technologies, Inc. * ;* All rights reserved. * ;* * ;* This script will retry a busy FTP site until a connection is made. It * ;* was designed especially for FTP sites that limit the number of anonymous * ;* logons and are difficult to reach. Run the script, then try the * ;* connection. If access is denied, the script will try it repeatedly until * ;* you are connected. ;* * ;* This ASPECT SCRIPT is intended only as a sample of ASPECT programming. * ;* DATASTORM makes no warranty of any kind, express or implied, including * ;* without limitation, any warranties of merchantability and/or fitness * ;* for a particular purpose. Use of this program is at your own risk. * ;***************************************************************************** ;***************************************************************************** ;* MAIN * ;* The Main procedure calls GetAddress when an FTP connection is made. * ;* * ;* Calls: GetAddress * ;* Modifies globals: * ;***************************************************************************** proc Main when $IPADDRESS call GetAddress ;When the IP address changes, ; start the retry process. while 1 ;Loop forever yield ;Yield processor time to other processes endwhile endproc ;***************************************************************************** ;* GetAddress() * ;* The procedure GetAddress gets the address to which the user is connecting.* ;* It then calls the DoRetry procedure to retry the connection. ;* * ;* Calls: DoRetry * ;* Called by: Main * ;***************************************************************************** proc GetAddress string szTryAddress ;Retry address szTryAddress = $IPADDRESS ;Get current IP address if strcmp szTryAddress "" ;If not currently connecting return ;Return to Main procedure. endif while $FTPCONNECT == 1 ;Loop here while connecting yield endwhile pause 1 ;Wait for connection to finish DoRetry(szTryAddress) ;Begin retrying endproc ;***************************************************************************** ;* DoRetry(string) * ;* This procedure loops as long as there is no FTP connection established. * ;* With each loop, it tries to establish a connection to the address passed * ;* to it. * ;* * ;* Calls: ExitScript * ;* Called by: GetAddress * ;***************************************************************************** proc DoRetry param string szTryAddress ;Address to retry string szDialogMsg ;Dialog box message strfmt szDialogMsg "Retrying %s" szTryAddress dialogbox 0 158 136 198 64 7 "FTP Retry" ;Cancel dialog text 1 8 14 176 8 szDialogMsg center pushbutton 2 77 38 40 14 "&Cancel" cancel default enddialog when dialog 0 call ExitScript while $FTPCONNECT != 2 ;Loop while not connected connectmanual FTP szTryAddress ;Try to establish FTP connection pause 1 ;Wait for connection to begin while $FTPCONNECT == 1 ;Loop here while connecting yield endwhile pause 1 endwhile exit endproc ;***************************************************************************** ;* ExitScript() * ;* This procedure is called when the user hits "Cancel" on the FTP Retry * ;* dialog to exit the script. * ;* * ;* Calls: * ;* Called by: DoRetry * ;***************************************************************************** proc ExitScript integer Event ;Dialog event number dlgevent 0 Event ;Get the event number that triggered this procedure switch Event case 2 ;If the "Cancel" button was pressed exit ;Exit the script endcase default ;If anything else triggered this procedure, endcase ; return to DoRetry endswitch endproc