Home Page
        Orders     Downloads     Support     Contact     Deutsch
ZOC Terminal is a professional SSH Client and Terminal Emulator for Windows and macOS.
PyroBatchFTP Online Help Topic:

Script Commands → Macros

The PyroBatch script language does not support variables, but it is possible to assign macros on the command line or use time and date macros inside the script to use values which are set from the Command Line or to build file names which depend on the date or time of day.

 

If you define a macros on the command line, e.g. /D:name=login001 /D:pass=secret, you can use these values in a script command by putting the name of the macro inside $(), e.g.
 
Example:  Connect server01, $(name), $(pass)

 

PyroTrans also provides some predefined macro names: $(date), $(year), $(year2) (two digits), $(month), $(monthname) (three characters), $(day), $(time), $(hour), $(minute), $(second), $(dayofweek) (one digit 0-6 for Su), $(dayofweekstr3) (three characters, Sun, Mon, etc.).

These are useful to build file names which depend on the system date, as in:
 
Example:  Put "sales.dat", "sales$(year)$(month)$(day).dat"

 

In addition to the local time, there are also macros based on UTC/GMT time gmt.time, gmt.hour, gmt.minute, gmt.second.

You can also build names based on the date of yesterday or tomorrow by adding yesterday. or tomorrow. to the date related names, e.g. $(yesterday.day), $(tomorrow.month) etc.:
 
Example:  Get "access_$(yesterday.year)$(yesterday.month)$(yesterday.day).log"

 

Also, the macros $(lasterror) and $(lastresult) will let you access the last error code or the result from the previous command.
 
Example:  LogToFile "$(date) $(time) $(lasterror)"

 

Additionally macros can be used to selectively exclude parts of the program from execution in C/C++ style. PyroBatchFTP does not support commands for making decisions based on the program execution, but the #ifdef/#ifndef and #endif commands can be used to selectively include/exclude commands based on availabiliby of command line macros.

 

The example below only send the sales/expenses files to the remote server if the corresponding macros were defined on the commandline when running the program (via /D:SENDSALES and/or /D:SENDEXPENSES). Otherwise the part of the program between #ifdef/#ifndef and #endif will be treated as comments:


 

 Connect ...
 #ifdef SENDSALES
 Put "oldsales.dat"
 Put "newsales.dat"
 RemoteChDir ".."
 #endif
 #ifdef EXPENSES
 Put "oldexpenses.dat"
 Put "newexpenses.dat"
 #endif
 Disconnect
 Exit

 
← Back to Script Commands

 

Downloads
Orders
Contact
Support
Terms of Use
Privacy Policy
pixel