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 "Relaying 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 sending of unsolicited commercial email (SPAM) through them. To solve this use the "EmailUser" and "EmailPass" variables before sending the message. Performer will then use these variables to authenticate with the server.

Let EmailServer = "mail.myserver.com"
Let EmailUser = "myUsername"
Let EmailPass = "myPassword"
Let EmailSender = "myEmailAddress"
Let EmailSenderName = "myName"
Let EmailSubject = "Sending mail with authentication"
Let EmailText = "This message will be sent through a server which requires
authentication."
AddRecipient "myRecipient@somewhere.com"
SendEmail

5.    I can't change values in 'enum' sections in the registry, what is wrong?

Most sections of the registry can be edited without any problem, except for the 'enum' sections. These sections contain critical information about your hardware. Without it Windows wouldn't start at all. This is why these sections can be changed only by the 'System' account. If you really need to change values in here, you can change the permissions using regedt32. It can be started from the command line. Navigate to the folder you want to change and select 'Permissions' from the 'Security' menu. In the popup window that appears you can enable 'full control' for the 'Everyone' account. Note that editing the registry is at your own risk.