Archives
- July 2019
- January 2019
- November 2018
- August 2018
- July 2018
- February 2018
- November 2017
- October 2017
- July 2017
- June 2017
- May 2017
- April 2017
- January 2017
- December 2016
- November 2016
- August 2016
- January 2015
- December 2014
- March 2014
- April 2013
- December 2010
- November 2009
- September 2009
- June 2009
- March 2009
- February 2009
- November 2008
- October 2008
- August 2008
- July 2008
- January 2008
A question regarding how to share parameters between many script files
I would like to share here a common question that from time to time it is answered via email (you can request tech support in the Contact section):
Dear Support:
Sorry to bother you, I looked at a few forum pages and could not search for ‘include’ (because it was ‘a too common word’). Just a high-level question in three parts as I am evaluating ScriptFTP:
1) Can I use the equivalent of an ‘#include <stdio.h>’ (C notation) to put common parts of scripts or functions into one place? All the examples I have seen were in one stand-alone ‘.ftp’ file.
2) If not possible, can I at least make a connection script that I call from another script and use it?
(For example on.ftp is the logon and off.ftp the logoff script, can I have a main.ftp that calls on.ftp, does some FTP stuff and calls off.ftp then?)
3) If 2) works, could I call the three .ftp scripts from a Powershell individually (in sequence)? Or do I lose the connection as soon as the script is done?So far I am impressed. The scripting is easy and straightforward, and from what I’ve read I can combine it with Powershell via command line… The best feature is the return code check after each command during the session. Good job.
And our answer here:
1) “Including” other script files within a script is not supported, sorry.
2) If you want to share server names, user names etc among many scripts try using GETENV (to retrieve an environment variable where you have stored the FTP server address, for example) or use GETPARAM which retrieves parameters from the command line. I hope this answer your question.
3) The connection is lost but you can call three script sequentially just call ScriptFTP.exe the_script_path.ftp. See ScriptFTP in the command line
ScriptFTP 4 version released
After many months of beta testing the version 4 will finally replace the version 3.3 (Although the old version can still be found in the Attic.
The changes from the version 3.3 are:
- SFTP support (previously only FTPS and plain FTP were supported)
- Faster script execution, lower load time.
- Automatically recover from lost connections and partial file transfers due connection fails.
- Integration with the task scheduler on newer versions of Windows (7, 8 and 8.1)
- Many minor changes and small fixes.