Heaventools

   English English  Deutsch Deutsch

Resource Tuner Scripts

You can create a script with any text editor as long as you save your script with a RTC-compatible script extension (.rts). The most commonly available text editor is already installed on your computer — Notepad.

There are no particular requirements except that every script must contain the Main procedure, enclosed by Sub and End Sub statements. Inside the Main procedure there can be any number of statements.

Make sure there's no line breaks. This is a requirement of VBScript: don't wrap the code lines, the entire command and all the parameters for one operation must be on one line.

Comments can be placed in the script by typing a single quotation mark at the beginning of a line. The script engine ignores all comments.

Example:

Sub Main
  '-------- Place your script here --------
    ... 
...
...
'----------------------------------------
end Sub


Command Line Setting Override

The Command Line Setting Override feature allows you to set/override the command-line settings right in the script body. This feature is very useful when you need to change the settings just for a single script, or be able to start different scripts with different settings without making them use different batch files.

To create a commmand line setting override, all you need to do is add #define attributes specifying the options you would like to override. These attributes must be separated with an empty line from the script code.

The following table details all the overrides:

Option Syntax Description

Scripting Language

#define ScriptLang LangName Specifies the scripting
language.
Logging On/Off #define Logging [on|off] Instructs whether or not to create a log file.
LogName #define LogName Name Specifies the name of a log file (including the full path)
Append Log On/Off #define AppendLog [on|off] Instructs whether or not to append a log to the existing log file.
Silent On/Off #define Silent [on|off] Instructs whether or not be silent.

Scripting Language

Lets you specify the Scripting Language. Any active scripting language installed and supported by Windows Script Host can be used for scripts. The syntax is as following:

#define ScriptLang LangName

where the LangName argument can have the following values:

vb VBScript Default scripting language
js JavaScript Default scripting language
perl Perl Should be installed on the system
python Python Should be installed on the system
rexx Rexx Should be installed on the system
tcl Tcl Should be installed on the system
lua Lua Should be installed on the system

RTC uses VBScript as its default scripting language. VBScript and JavaScript are included as components with Edge/Internet Explorer, which should be installed already on your computer. Whether you're using Perl, Python, Rexx, TCL, or Lua as the scripting language, ensure that the corresponding modules are already installed on the system.

Log Name

Lets you specify the name of a log file (including the full path, if any) and causes the program to create a log file detailing all events and actions taken during the editing process. The syntax is as following:

#define Logname Name

where Name is the name of a log file. Don't forget to use quotes if the log name contains spaces.


Example of Commmand Line Setting Overrides:
  
'---------script body starts here----------

#define ScriptLang vb
#define Silent off
#define Logging on
#define Appendlog off
#define Logname "c:\test\test_log.txt"

'--------------------------------------------------------------------------------

' The above attributes must be separated with an empty line from the script code.

'--------------------------------------------------------------------------------

Sub Main
  '-------- Place your script here --------
    ... 
...
...
'----------------------------------------
end Sub


 Documentation on WSH and VBScript

A familiarity with VBScript helps with reading and writing the scripts. The documentation on VBScript and Windows Scripting in general can currently be found at:

Learn.microsoft.com
VBScript Language Reference

Download a zipped copy of the last published script documentation on WSH and VBScript from Microsoft for ready reference, it is available as a handy .CHM file. Make sure to install it and spend some time browsing through it. Then when you need it maybe you will not have much of a struggle finding what you need.

 

Sample Scripts
 Download Resource Tuner Console and learn how it can make you more productive.