Scripting Q&A

The following are some commonly asked questions relating to using the scripting language.

 

1. Can I call a script from the command-line?

Yes you can. You will need to call the file RunScript.exe (executes the script) in the command-line and then pass the script name to it as a parameter.

 

Example:

Runscript.exe "Scripts\mytransfer.ftp"

 

 

2. Can I pass parameters to a script instead of storing data in a script?

Yes, parameter can be passed to a script from the command-line. In a script a parameter is represented by the variable ParamX where x represents the number identifying the parameter. Such as:

 

Runscript.exe "myscript.ftp" "Param1" "Param2" "Param3"

 

For example if my script using parameters was as follows.

 

; *****************************************************

; Parameters.ftp

; =============

host="%%param1%%"

user="%%param2%%"

password="%%param3%%"

connect

message "connected"

disconnect

; *****************************************************

 

The following would be a command-line that would work with it.

 

Runscript.exe "Parameters.ftp" "ftp.transsoft.com" "anonymous" "me@here.com"

 

 

3. I have a script written for work and it is scheduled to execute everyday. How do I stop it from executing on the weekends since it is not needed to run at those times?

At the beginning of your script you need to add a few statements to check the day of the week, and to cancel the execution if the day of the week is Saturday or Sunday.

 

numvariable x

let x=DayOfWeek("%%Today%%")

;Where 1=sunday, 2=monday.....

If %%x%%=1 then

goto end

endif

if %%x%%=7 then

goto end

endif

 

;

;Your script goes here!!!

;

 

:end

 

 

4. I am unable to send an email through the scripting, what is wrong?

The SMTP server is likely giving you a "Relying Denied" message in the log. The server is refusing to pass along your message since it does not recognize you. Many Internet providers and companies have their SMTP servers acting in this manner in an effort to prevent the relaying of unsolicited commercial email (SPAM) through them.