General Information - General Functions A-R - Flow Control Functions
General Functions S-Z

Functions
ActivateWindowWithClass IsKeyDown
ActivateWindowWithIdentifier IsVariable
ActivateWindowWithTitle KeySequence
AddToVariable LoadSystemVariables
Beep MacroMachineIsRunning
BlockInput MacroMachinePopupMenu
Calculate MacroMachineQuit
Call MacroMachineStart
CallScript MarkActiveWindow
CallURL Menu
ChangeWindow MouseButton
ConvertVariableToNumber MouseMove
ConvertVariableToReal MouseSequence
ConvertVariableToText MouseWheel
CopyFile MoveFile
CountFiles MultiplyVariable
CreateFolder PrintDebug
DeleteFile Prompt
DevideVariable RegGetValue
EnsureWindowWithIdentifier RegSetValue
Execute RenameFile
ExecuteAndWaitForWindow ResetInternet
FindChild RSIShieldIsPause
FindWindow RSIShieldIsRunning
FocusWindow RSIShieldPopupMenu
GetActiveWindowClass RSIShieldQuit
GetActiveWindowIdentifier RSIShieldStart
GetActiveWindowTitle SendKeys
GetCursorPos SendKeysAndWaitForWindow
GetGlobalValue SendMail
GetRSIShieldValue SetGlobalValue
GetStatusbarText SetRSIShieldValue
GetTickCount SetSendKeysSimulationSpeed
GetWindow SetSequenceSpeed
GetWindowClass SetVariable
GetWindowRect ShowRectangle
GetWindowText ShowRunTimeErrors
I_BrowserGetTitle Stop
I_BrowserGetURL StopInternet
I_BrowserIsBusy StopOnFailure
I_BrowserNavigate StrDelete
I_Connect StrFind
I_Disconnect StrFromAscii
I_ElementClick StrFromClipboard
I_ElementFocus StrFromFile
I_ElementGetChecked StrGetValue
I_ElementGetHTML StrHash
I_ElementGetInfo StrHexToFile
I_ElementGetPos StrInsert
I_ElementGetRect StrLeft
I_ElementGetRecurrenceIndex StrLength
I_ElementScrollIntoView StrLower
I_ElementSelect StrMid
I_ElementSetChecked StrNameFormat
I_ElementSetValue StrReplace
I_FindDocumentFromPoint StrRight
I_FindElement StrToAscii
I_FindElementFromPoint StrToClipboard
I_GetActiveDocument StrToFile
I_GetDocumentCount StrTrim
I_Parse StrUpper
I_SetActiveDocument SynchFiles
I_WaitForComplete TimeoutPrompt
I_WaitForElement Unzip
I_WaitForInteractive Wait
Input WaitForInternet
Internet WaitForWindow
IsActiveWindow Zip
* Newly added command since last version

SendKeys(text KeyStrokes, text/number WaitAfterInput = 50)

This function has one required and one optional parameter:
text KeyStrokes: The key strokes to send to the foreground window
text/number WaitAfterInput: The time (in milliseconds) to wait after all key strokes have been sent

Use this function to simulate pressing some keys on the keyboard. If a modifer key is left in its pressed (down) state at the end of the command, the command automatically releases them. A modifier key is one of these keys: Shift, Ctrl, Alt or Windows. When you use a key like [CTRL-LOCK], the first time you call it the Ctrl key gets pressed down, and the second time you call it, it gets released. This is called a toggle state.

Normally you would enter the text, as you would want it to appear in the application, as the first parameter of this function. But some keys are special and can not be represented by a single character, those keys are listed below. When you want to press such a key, you just enter the text from the first column into the KeyStrokes parameter-string.

When you want to press a special key (from the list below) more than once, you can do so by using the : (colon) symbol. e.g. [ENTER:5] will press the Enter key 5 times. And [BACK:3] will press the Backspace key 3 times.

Special Keys Description
Modifiers  
[SHIFT] Hold down the Shift key until the fist non modifier key
[ALT] Hold down the Alt key until the fist non modifier key
[CTRL] Hold down the Ctrl key until the fist non modifier key
[WIN] or [WINDOWS] Hold down the Windows key until the fist non modifier key
   
[SHIFT-LOCK] Toggle the Shift key's down state
[ALT-LOCK] Toggle the Alt key's down state
[CTRL-LOCK] Toggle the Ctrl key's down state
   
[SHIFT-ONLY] Just press the Shift key and release it (not really a modifier)
[ALT-LOCK] Just press the Alt key and release it (not really a modifier)
[CTRL-ONLY] Just press the Ctrl key and release it (not really a modifier)
[WIN-ONLY] or [WINDOWS-ONLY] Just press the Windows key and release it (not really a modifier)
   
Other  
[APPS] or [CONTEXT-MENU] Press the Applications (context-menu) button
[PGUP] or [PAGEUP] Press Page Up
[PGDWN] or [PAGEDOWN] Press Page Down
[INSERT] Press Insert
[F1] Press F1
[F2] Press F2
[F3] Press F3
[F4] Press F4
[F5] Press F5
[F6] Press F6
[F7] Press F7
[F8] Press F8
[F9] Press F9
[F10] Press F10
[F11] Press F11
[F12] Press F12
[TAB] Press Tab
[ENTER] or [RETURN] Press Enter
[ESC] or [ESCAPE] Press Escape
[DOWN] Press Arrow Down
[UP] Press Arrow Up
[LEFT] Press Arrow Left
[RIGHT] Press Arrow Right
[DEL] or [DELETE] Press Delete
[BACK] or [BACKSPACE] Press Backspace
[HOME] Press Home
[END] Press End
[SPACE] Press Spacebar
[0] Press 0 key on the Number Pad
[1] Press 1 key on the Number Pad
[2] Press 2 key on the Number Pad
[3] Press 3 key on the Number Pad
[4] Press 4 key on the Number Pad
[5] Press 5 key on the Number Pad
[6] Press 6 key on the Number Pad
[7] Press 7 key on the Number Pad
[8] Press 8 key on the Number Pad
[9] Press 9 key on the Number Pad
[*] Press Multiply key on the Number Pad
[+] Press Add key on the Number Pad
[-] Press Subtract key on the Number Pad
[.] Press Decimal key on the Number Pad
[/] Press Devide key on the Number Pad
[CTRL-BREAK] Press Ctrl+Break combination
[PAUSE] Press Pause
[CAPSLOCK] Press Caps Lock
[NUMLOCK] Press Num Lock (only on NT 4.0 or higher)

Example:
SendKeys("RSI-Shield is very good break software[ENTER][ENTER]")
SendKeys("
RSI-Shield is very good break software[ENTER:2]")

Example:
// This will enter the text 'My name is: John Flemming' into the active application
SetVariable("name", "John Flemming")
SendKeys("My name is: %name%")

SendKeysAndWaitForWindow(text KeyStrokes, text/number WaitAfterInput = 50, text/number MaxWaitInMilliSeconds = 30000)

This function is the same as the function SendKeys, but it has an additional parameter:
text KeyStrokes: The key strokes to send to the foreground window
text/number
MaxWaitInMilliSeconds: The maximum number of miliseconds to wait for a new window to appear

Use this function to send some keys strokes to the currently active window, just like you would use the SendKeys command. This command, however, waits until a new window appears. A new window has appeared if the foreground window has changed since the beginning of the script, or since the last MarkActiveWindow command, or since the last ...WaitForWindow.. variant command.
This command implicitly calls MarkActiveWindow.

Example:
// Start notepad and wait for it to appear
ExecuteAndWaitForWindow("
notepad.exe")
// Enter some text into notepad
SendKeys("
Just some text")
// Open the 'Save As' dialog and wait for it to appear
SendKeysAndWaitForWindow("
[ALT]fa")
// Enter the name of the file into the 'Save As' dialog
SendKeys("
c:\Sample.txt")

SendMail(text MailServer, text UserName, text Password, text FromName, text FromAddress, text To, text Subject, text Message, text CC="", text BCC="", text Attachments="", text/number isHTML=0, text/number Port = 25, text CharSet = "iso-8859-1" )

text MailServer: The name or IP address of the mail server
text UserName:
The username for authentication for the mail server. If no username is required, use an empty string
text Password:
The password for authentication for the mail server. If no username is required, use an empty string
text FromName:
The name of the sender
text FromAddress:
The e-mail address of the sender
text To:
The visible recipients. Separate multiple recipients, by using a comma or semicolon. Add 'friendly' names by entering the name, and the e-mail address behind it between <> symbols
text Subject:
The subject of the message
text Message:
The message itself. Set the isHTML parameter to 1 if this message is a HTML message
text
CC: The visible recipients. Separate multiple recipients, by using a comma or semicolon. Add 'friendly' names by entering the name, and the e-mail address behind it between <> symbols
text BCC: The invisible recipients. Separate multiple recipients, by using a comma or semicolon. Add 'friendly' names by entering the name, and the e-mail address behind it between <> symbols
text Attachments: The paths of the attachments. Separate multiple attachments, by using a comma or semicolon.
text isHTML: Specifies whether the message is a HTML message or a normal text message
text Port: The SMTP port of the mail server
text CharSet: The character set that must be used for the message

Use this function to send an e-mail message via the SMTP protocol.

Example:
// Let's send a message to tronan
SendMail("
smtp.domain.com", "", "", "MyName", "myname@mydomain.com", "Feedback <feedback@tronan.com>", "MySubject", "Hello world!")

SetGlobalValue(text ValueName, text Value)

This function has two required parameters:
text ValueName: The name of the Global Value one wants to store information in
text Value: The information itself, one wants to store in the Global Value

This function is used to write information into a Global Value. Global Values can be used to pass data between different Macro Scripts.

Example:
StopOnFailure(
0)
// Call a script to get the name of the user
Input("firstname", "What is your first name? ")
IsVariable("
firstname")
if_succeeded()

 

// Store the first name, so another script can retrieve them
SetGlobalValue("FirstName", "%firstname%")

end()

SetRSIShieldValue(text ValueNameAndParameters)

This function has one required parameters:
text ValueNameAndParameters: The name and parameters of the value you want to set in RSI-Shield.

Value Name Description
auto_mouse_click_enabled(0/1 Enabled) Specify if the auto mouse click function is enabled.
auto_snooze_enabled(0/1 Enabled) Specify if the auto-snooze (when using a modem) function is enabled.
break_warning_enabled(0/1 Enabled) Specify whether or not a notification will be shown before a break starts.
break_warning_time(number Seconds)
Specify the time (in seconds) before a break when the break-notification will be shown.
clear_statistics(text ProfilePath) Clears the statistics of a user profile. You must supply a fully qualified path of a profile.
consider_natural_breaks(0/1 Enabled)
Specify whether or not the RSI-Shield intelligence considers the breaks users take naturally.
consider_user_input(0/1 Enabled)
Specify whether or not RSI-Shield stops counting down (the counter) when a user does not use the PC.
countdown_on_user_input(number Seconds) Specify how many seconds are counted down when a user uses the computer briefly.
create_timeline(number SmallestActivePeriod, number SmallestBreakPeriod, number ActivePeriod2Multiplier, number BreakPeriod2, number ActivePeriod3Multiplier, number BreakPeriod3) Specify the time line of RSI-Shield. This time line specifies exactly when a micro, medium, or macro break should be held. SmallestActivePeriod = The time one can work, SmallestBreakPeriod = The Micro break length (seconds), ActivePeriod2Multiplier = Every which time a Medium break will be held i.s.o. a Micro break, BreakPeriod2 = The Medium break length (seconds) etc.
create_with_defaults(0/1 KeepStatistics) Reset the user profile to reflect the default settings (that can be found in the environment.ini file). One can choose to keep the statistics, or to really create a new/empty profile.
delete_dead_macro_hotkeys Remove all hotkeys that are not bound to a valid macro path.
delete_dead_triggers Remove all triggers that are not bound to a valid macro path.
disable_keyboard_during_break(0/1 Enabled) Specify whether or not RSI-Shield blocks keyboard input during a break.
disable_mouse_during_break(0/1 Enabled) Specify whether or not RSI-Shield blocks mouse input during a break.
hours_visible(0/1 Enabled) Specify whether or not the hours are shown in the counter (in the system tray).
key_sound(text Sound) Specify the name of the sound that will be played when a user hits a key (will be empty if no sound is selected). The Sound parameter can be one of the following: empty = no sound, PCSPEAKER = pc speaker, or a fully qualified path to a *.wav file.
keyboard_2_mouse_translator_enabled(0/1 Enabled) Specify if the 'keyboard 2 mouse translator' is enabled. When it is, one can control the mouse with the keyboard.
language(text Language) Specify the language of RSI-Shield. Can be Dutch, or English.
load_profile(text Path) Loads another user profile into RSI-Shield. One has to specify a fully qualified path to the profile. (TIP use GetRSIShieldValue to determine the profile folder).
load_skin(text SkinName) Specify the name of the skin (the appearance of the counter) that is currently used. (e.g. Transparent, or Default40)
macro_hotkey(number Index, number VirtualKey, number Modifiers, text Path)


Specify which macro, can be activated with which key combination at a certain index (Index = a number between 0 and 74). (Click here for VirtualKey ,Modifiers). Path = the path of the macro (relative to the Macros root-folder). One can find an empty hotkey-slot by using GetRSIShieldValue with the value empty_macro_hotkey_pos.

macro_trigger(number Index, text Sequence, text Path)
Specify which macro, can be activated with which sequence of characters, at a certain index (Index = a number between 0 and 74). Path = the path of the macro (relative to the Macros root-folder). One can find an empty trigger-slot by using GetRSIShieldValue with the value empty_trigger_pos.
max_exercises(number MaxExercises)
Specify the maximum number of exercises that will be played during a break.
max_snooze_count(number MaxSnoozeCount)
Specify the maximum number of times one can postpone a break.
max_snooze_time_enabled(0/1 Enabled)
Specify whether or not the maximum snooze time is overridden by the user. If the value is 0, postponing a break will give the maximum amount to work. If the value is 1, the max_snooze_time value specifies how many seconds of working time one will regain.
max_snooze_time(number Seconds)
Specify how many seconds a snooze-action will jump back in time (will only work if the max_snooze_time_enabled value is set, so first set that value).
minutes_visible(0/1 Enabled)
Specify whether or not the minutes are shown in the counter (in the system tray).
natural_break_multiplier(number BreakIndex, real Multiplier)
Specify which multiple of the length of the corresponding break type, is considered to be a natural break. e.g. If the length of a micro break is 60 seconds, and the 'natural break multiplier' is 2, then one should not touch the PC for 120 seconds, to make RSI-Shield treat the break as a valid natural break.
no_discipline_mode_enabled(0/1 Enabled)
Specify if the no-discipline mode is enabled.
password(text OldPassword, text NewPassword) Specify the password that protects the statistics of the current user profile. If the old password is empty, just provide the word NONE.
play_sound(text Sound) Play a RSI-Shield event sound. e.g. event_warning (see the folder: C:\Program Files\Tronan\RSI-Shield\Sounds)
recreate_display Recreates the RS-Shield counter.
register(text UserName, text RegistrationCode) Registers RSI-Shield using the specified user name, and registration code. This value can only be set once a minute (for security reasons). This registration only last for the current session (if one restarts RSI-Shield the registration is gone). One has to modify the register.ini file to actually make the registration persistent.
save_profile(text Path) Saves the current user profile to the specified file. One has to specify a fully qualified path to the profile. (TIP use GetRSIShieldValue to determine the profile folder, and current profile name).
snooze_key_combination(number ModifierKeys, number VirtualKeyCode)
Specify the key combination that can be used to postpone breaks. One has to specify the virtual key code, and the the modifier keys. (Click here for VirtualKey ,Modifiers).
show_balloon Creates an text balloon that points to the RSI-Shield counter.
show_exercises_during_break(number BreakIndex)
Specify if exercises will be shown during a specific type of break (BreakIndex).
snooze_notification_animation(0/1 Enabled) Specify whether or not a notification movie will be played when a break is postponed.
sound_enabled(0/1 Enabled)
Specify if sounds are enabled. If so, sounds will be played to notify users of events (beginning of a break etc.)
timeline_position(number Seconds)
Specify the current position (in seconds) of RSI-Shield on the time line.

Virtual Key Codes: A special code that identifies an actual key on the keyboard Click here for a table.

Modifiers: A key combination with one or more of these keys: Alt (1), Ctrl (2), Shift (4), Win (8). You just add the values together to create a combination (e.g. if Modifiers = 7, the keys Ctrl+Alt+Shift are all used).


BreakIndex: Some values require that you specify a break index. This means that the value is valid for a micro break, medium break, and macro break. So you have to specify via an index, in which one you are interested (1 = Micro break, 2 = Medium break, 3 = Macro break)

Use this function to change some specific RSI-Shield settings. Note, that you have to save the profile after you have made the changes, if you want to keep them.

Example:
// Change the skin that RSI-Shield is using
SetRSIShieldValue("load_skin(Transparent)")
if_failed()

Prompt("Could not change the skin")
Stop()

end()

// Now save the profile
GetRSIShieldValue("
prof_dir", "profile_folder")
GetRSIShieldValue("
cur_prof", "current_profile")
SetRSIShieldValue("
save(%prof_dir%%cur_prof%.rsf)")

SetSendKeysSimulationSpeed(number MinWaitBeforeKey = 0, number MaxWaitBeforeKey = 0)

This function has two optional parameters:
number MinWaitBeforeKey: How long should be waited at least before hitting a key (in milliseconds)
number MaxWaitBeforeKey: How long should be waited at most before hitting a key (in milliseconds)

Use this function to make the SendKeys and SendKeysAndWaitForWindow commands look like they are really typing. Normally they will enter the keys as fast as possible. But when you have called this function, they will wait a random amount of time before they will enter the key.

You can reset the behavior by calling this function without parameter.

Example:
// Start notepad and wait for it to appear
ExecuteAndWaitForWindow("
notepad.exe")
// Make this look like someone is actually typing
SetSendKeysSimulationSpeed(
0, 300)
// Enter some text into notepad
SendKeys("
This looks like someone is really typing it")

SetSequenceSpeed(text/number Speed)

This function has one required parameter:
text/number Speed: How much faster the KeySequence and MouseSequence commands should be played-back (0 = fastest, 1-15 = times the normal speed)

Use this function to speed-up the play-back of the KeySequence and MouseSequence commands. The speed can vary from 1 to 15. 1 is normal speed and 15 is 15 times as fast (as normal). The value 0 has a special meaning; this means the sequence gets played-back without waiting at all. So this is the fastest way to play a sequence.

Example:
// Enter the text: Hello
KeySequence("150,[SHIFT],1, 511,[H],0, 160,[SHIFT],2, 100,[E],0, 110,[L],0, 141,[L],0, 220,[O],0, 100,[RETURN],0")
// Now, enter the same text 15 times faster
SetSequenceSpeed(
15)
KeySequence("
150,[SHIFT],1, 511,[H],0, 160,[SHIFT],2, 100,[E],0, 110,[L],0, 141,[L],0, 220,[O],0, 100,[RETURN],0")

SetVariable(text VariableName, text/number/real Value)

This function has two required parameters:
text VariableName: The name of the variable to set the value of
text/number/real Value: The value to store into the variable

Use this function to store some value in a variable. The variable wil be of the same type as the value you stored in it.

Example:
// Initialize the house number with the text 10
SetVariable("house_number", "10")
// Convert the house number to a number, so you can calculate with it
ConvertVariableToNumber("
house_number")
// Calculate the neighbours house number
AddToVariable("
house_number", 2)
// Show the result
Prompt("
The neighbours of number 10 live at number %house_number%")

ShowRectangle(text/number left, text/number top, text/number width, text/number height, text/number Timeout = 2000, text/number ColorRed = 255, text/number ColorGreen = 0, text/number ColorBlue = 0)

text/number left: the left coördinate of the rectangle (absolute screen coördinates)
text/number top: the top coördinate of the rectangle (absolute screen coördinates)
text/number
width: the width of the rectangle (in pixels)
text/number height:
the height of the rectangle (in pixels)
text/number Timeout: How long should the rectangle be shown (in milliseconds)
text/number ColorRed: The red value of the RGB color for the rectangle (0-255)
text/number ColorGreen: The green value of the RGB color for the rectangle (0-255)
text/number ColorBlue: The blue value of the RGB color for the rectangle (0-255)

Use this function to display a rectangle on the screen. There can only be one rectangle on the screen at any time. A new call to ShowRectangle will hide the previous rectangle (if it was still visible).

Example:
// Show a rectangle
ShowRectangle(
100, 100, 200, 100)

// Wait 3 seconds, otherwise the rectangle would disappear immediately

Wait(
3000)

ShowRunTimeErrors(text/1/0 ShowRunTimeErrors = 1)

This function has one optional parameter:
text/1/0 ShowRunTimeErrors: Flag to indicate whether or not runtime errors should be shown (1 = Do show, 0 = Do not show)

Use this function if you want to be warned about runtime errors (such as time-outs when you use a ..WaitForWindow.. function etc.). Normally such a runtime error, will cause the script to stop, but it will stop silently, you will not be notified. If you run the script from within the Tronan Macro Editor, you do not have to use this function, since runtime errors will be shown in the output window of the Tronan Macro Editor.

Example:
// We want to be notified of runtime errors
ShowRunTimeErrors(1)
// We will wait for a window to appear (for 5 seconds)
// Since this window will never appear, this will generate a runtime error (timeout)
// Of which we will be notified, because we have indicated so
WaitForWindow("dfasdjfasdkf", 5000)

Stop(text/1/0 StopAllScripts = 0 )

This function has one optional parameter:
text/1/0 StopAllScripts: Flag to indicate whether or all scripts should stop, or just this script (1 = Stop all scripts, 0 = Just this script)

Call this function to stop executing the macro script. When 'StopAllScripts' is 1, the parent script that called this script, using the CallScript command, will be stopped too.

Example:
// We want to handle the errors ourself
StopOnFailure(0)
// Lets execute a program that does not exist (it will fail)
Execute("
BadProgram.exe")
// Test the result of the last command
if_failed()
  // Stop the script
Stop()
end()

// This will never get processed
SendKeys("
[ENTER]")

StopInternet()

This function has no parameters.

Call this function to instruct Tronan Browser to stop loading anything. Is the same as pressing the Escape button (or the stop button) in the Internet Explorer.

Example:
// Start loading an internet page
Internet("http://www.tronan.com")
// Stop loading it
StopInternet()

StopOnFailure(text/1/0 StopOnFailure = 1)

This function has one optional parameter:
text/1/0 StopOnFailure: Flag to indicate whether or not the script should continue when an error occurs (0 = continue script, 1 = stop script)

Call this function to indicate whether or not a script should stop after an error has occured. Default a script stops when an error occurs. But sometimes you don't want that (you might want to handle the error yourself).

Example:
// We want to handle the errors ourself
StopOnFailure(0)
// Lets execute a program that does not exist (it will fail)
Execute("
BadProgram.exe")
// Test the result of the last command
if_failed()
  // Stop the script
Stop()
end()

// This will never get processed
SendKeys("
[ENTER]")

StrDelete(text VariableName, text/number FromPosition, text/number NumberOfChars)

This function has three required parameters:
text VariableName: The name of the variable to delete the substring in
text/number FromPosition: The starting position from where to delete
text NumberOfChars: The number of characters to delete

Call this function to delete a sub-string in a string.

Example:

// Fill the text variable
SetVariable("var", "name=John")
// Delete the sub-string 'name='
StrDelete("var", 0, 5)
// Show the name
Prompt("%var%")

StrFind(text VariableName, text SourceString, text SubString, text/number StartPosition = 0)

This function has three required parameters, and one optional:
text VariableName: The name of the variable to set the position of the substring into (-1 means that it is not found)
text SourceString: The string to search in
text SubString: The sub-string to search for in the source-string
text/number StartPosition: The zero-indexed start position to start the search from (in the source string).

Call this function to search for a sub-string in a string. This function determines the (zero-indexed) position of the sub-string (or -1 if it is not found).

Power Tip: You can also use regular expressions with this function. All you have to do is put the indicator 'REGEXPR:' in front of the SubString. The parameter StartPosition isn't used then and the returned value (VariableName) is not the position, but it indicated whether or not a match is found. Furthermore, VariableName.Count is the number of sub strings found, and VariableName[index].Position, VariableName[index].Length, VariableName[index].Value, are respectively the position, the length, and the value of the found sub string. Click here for an example.

Example:

// Fill the text variable
SetVariable("
var", "name=John")
// Look for the sub-string 'name='
StrFind("
pos", "%var%", "name=")
if("pos", ">", -1)

// If the sub-string was found
// Determine the length of the sub-string

StrLength("
length", "name=")
// and increase the found position with that size
// (so we skip the sub-string itself).

AddToVariable("
pos", "%length%")
// Now we get the rest of the string (that is behind that position)
StrMid("
var", "%var%", "%pos%")
// And we show the name
Prompt("
%var%")

end()

StrFromAscii(text VariableName, text/number AsciiCode)

This function has two required parameters:
text VariableName: The name of the variable to load the symbol from the ASCII table into.
text AsciiCode: A number from the ascii table (0-255).

Call this function to put a symbol from the ASCII table into a text variable.

Example:

// Gets the symbol corresponding with index no 65 from the ASCII table
StrFromAscii("
var", 65)
// Show the letter A
Prompt("
%var%")

StrFromClipboard(text VariableName)

This function has one required parameter:
text VariableName: The name of the variable to load the content of the file into.

Call this function to load the current text-content of the clipboard into a variable.

Example:

// Load the content of the clipboard into a text variable
StrFromClipboard("
var")
// Show the content
Prompt("
%var%")

StrFromFile(text VariableName, text FilePath)

This function has two required parameters:
text VariableName: The name of the variable to load the content of the file into.
text FilePath: The path of a file.

Call this function to load the content of a text file into a variable.

Example:

// Load the file into the text variable
StrFromFile("
var", "C:\\autoexec.bat")

StrGetValue(text VariableName, text SourceText, text BeginSubString, text EndSubString, text BeginPosVariable)

This function has five required parameters:
text VariableName: The name of the text variable that will receive the found value.
text SourceText: The source text in which the value will be searched for.
text BeginSubString: The sub-string that marks the beginning of the value.
text EndSubString: The sub-string that makrs the end of the value. If an empty EnsSubString is supplied, the end of the SourceText will be considered the end-mark.
text BeginPosVariable: The name of a variable that contains the position (zero-indexed) in the SourceText string, to begin the search of the value from. The contents of that variable, will be changed to correspond with the end-position of the found value (if the value is not found, the contents remains unchanged).

Call this function to 'parse' a text and extract values from it.

Example:

// Initialize a variable with some text (\r\n = new line)
SetVariable("orgText", "First Name: John, Last Name: Smith, Tel: 0384729234\r\nCountry: UK")
// Show the original text
Prompt("%orgText%", "Original Text")

// We begin to search for the values from position 0
SetVariable("
position", 0)
// Get the values
StrGetValue("
FName", "%orgText%", "First Name:", ",", "position")
StrGetValue("
LName", "%orgText%", "Last Name:", ",", "position")
StrGetValue("
Tel", "%orgText%", "Tel:", "\r\n", "position")
StrGetValue("
Country", "%orgText%", "Country:", "", "position")

// Show the values

Prompt("
FName=%FName%, LName=%LName%, Tel=%Tel%, Country=%Country%"")

StrHash(text VariableName, text SourceString)

This function has two required parameters:
text VariableName: Name of the variable that can be used to store the result in
text SourceString: The text-string of which the hash needs to be calculated

Call this function to determine the hash of a text-string. A hash is a number that can be used to uniquely identify a string.

Example:

// Determine the hash
StrHash("
hash", "Make a unique id of this line")
Prompt("%hash%")

StrHexToFile(text FilePath, text VariableName)

This function has two required parameters:
text FilePath: The path of a file.
text VariableName: The Hexadecimal text that should be converted and stored in a binary file.

Call this function to convert a string that contains hexadecimal values, to a binary file. This allows a sort of attachments in a macro script. A script can contain a binary file, and extract it out of the script onto the hard drive. The Tronan Macro Editor has a tool (in the Tools menu) to convert binary files to a string of hexadecimal values.

Example:

// Put some Hexadecimal stuff in a variable
SetVariable("buffer", "536F6D6520746578742E2E")
// Convert the hexadecimal stuff to a binary file (in this case simply a text file, though)
StrHexToFile("
C:\\ReadMe.txt", "buffer")

StrInsert(text VariableName, text StringToInsert, text/number InsertPosition)

This function has three required parameters:
text VariableName: The name of the variable to insert the string into
text StringToInsert: The string to insert
text/number InsertPosition: The position where to insert the string

Call this function to insert a string in a string.

Example:

// Fill the text variables
SetVariable("
var", "John")
SetVariable("
insertStr", "name=")
// Insert the sub-string 'name=' in front of 'John'
StrInsert("var", "%insertStr%", 0)
// And we show 'name=John'
Prompt("%var%")

StrLeft(text VariableName, text SourceString, text/number NumberOfChars)

This function has three required parameters:
text VariableName: The name of the variable to store the string into
text SourceString: The string to select a part of
text/number NumberOfChars: The number of characters to select; starting on the left of the string

Call this function to select part of a string; starting on the left.

Example:

// Fill the text variable
SetVariable("
var", "John")
// Select the first letter of the name
StrLeft("firstLetter", "%var%", 1)
// And we show first letter of the name
Prompt("%firstLetter%")

StrLength(text VariableName, text SourceString)

This function has two required parameters:
text VariableName: The name of the variable to set the length of the string into
text SourceString: The string to detemine the length of

Call this function to determine the length of a string.

Example:

// Fill the text variables
SetVariable("
var", "name=")
SetVariable("
firstname", "John")
// Determine the length of the string stored in the variable 'var'
StrLength("length", "%var%")
// Insert the sub-string 'John' after 'name='
StrInsert("var", "%firstname%", "%length%")
// And we show the name 'John' after 'name='
Prompt("%var%")

StrLower(text VariableName)

This function has one required parameter:
text VariableName: The name of the variable to convert to lower case characters

Call this function to covert all upper case characters of a string to lower case characters.

Example:

// Fill the text variable
SetVariable("var", "John")
// Convert all the characters in the string to lower case characters
StrLower("var")
// And we show the name; notice the 'j' is now in lower case
Prompt("%var%")

StrMid(text VariableName, text SourceString, text/number FromPosition, text/number NumberOfChars)

This function has three required parameters and one optional parameter:
text VariableName: The name of the variable to store the string into
text SourceString: The string to select a part of
text/number FromPosition: The starting position; where to begin the selection of the sub-string
text/number NumberOfChars: The number of characters to select; starting at FromPosition. When this parameter is not used, the remainder of the string will be selected.

Call this function to select part of a string; starting on the left.

Example:

// Fill the text variable
SetVariable("var", "John")
// Select the second letter of the name
StrMid("var", "%var%", 1, 1)
// And we show second letter of the name
Prompt("%var%")

StrNameFormat(text VariableName, text OrgText)

This function has two required parameter:
text VariableName: The name of the variable to put the result in.
text OrgText: The original text which should be Name-Formatted.

Call this function to Name-Format a text. The function will make all words lower-case except for the first letters, they will be capitalized. It will also replace all reparative white space-characters (space, tabs, enters etc.) by just one character. Furthermore, the will text be Trimmed (the white space characters on the left and right of the text will be removed).

Example:

// Fill the text variable; notice the spaces
SetVariable("var", "    mY nAme IS joHN sMith.   ")
// Name-Format the text
StrNameFormat("var", "%var%")
// Show the text 'My Name Is John Smith'
Prompt("%var%")

StrReplace(text VariableName, text OldSubString, text NewSubString)

This function has three required parameters:
text VariableName: The name of the variable to replace a sub-string of
text OldSubString: The sub-string to replace
text NewSubString: The sub-string to replace the OldSubString with

Call this function to replace part of a string.

Example:

// Fill the text variable
SetVariable("var", "John")
// Replace 'oh' with 'a'; to change 'John' into 'Jan'
StrReplace("var", "oh", "a")
// And we show the changed name 'Jan'
Prompt("%var%")

StrRight(text VariableName, text SourceString, text/number NumberOfChars)

This function has three required parameters:
text VariableName: The name of the variable to store the string into
text SourceString: The string to select a part of
text/number NumberOfChars: The number of characters to select; starting on the right of the string

Call this function to select part of a string; starting on the right.

Example:

// Fill the text variable
SetVariable("
var", "John")
// Select the last letter of the name
StrRight("lastLetter", "%var%", 1)
// And we show last letter of the name
Prompt("%lastLetter%")

StrTrim(text VariableName)

This function has one required parameter:
text VariableName: The name of the variable to trim the spaces out of

Call this function to cut all spaces infront of, and at the end of a string.

Example:

// Fill the text variable; notice the spaces
SetVariable("var", " John ")
// Trim the spaces out of the variable 'var'
StrTrim("var")
// Add the lastname 'Jones' to the first name
AddToVariable("var", "Jones")
// And we show the name; notice the spaces are gone in 'JohnJones'
Prompt("%var%")

StrToAscii(text VariableName, text Character)

This function has two required parameters:
text VariableName: The name of the variable to load the the ASCII code (0-255) of the character into.
text Character: The character from the ascii table you want to know the code (0-255) of.

Call this function to determine the ASCII code of a symbol.

Example:

// Get the ASCII code of the 'A' character
StrToAscii("
code", "A")
// Show the code (65)
Prompt("
%code%")

StrToClipboard(text Text)

This function has one required parameter:
text Text: The text that should be stored on the clipboard.

Call this function to save text onto the clipboard.

Example:

// Put some text on the clipboard
StrToClipboard("
This sentence can be pasted into an application by pressing Ctrl+v")
// Lets paste it
SendKeys("[CTRL]v")

StrToFile(text FilePath, text Text, 1/0 AppendMode = 0)

This function has two required parameters:
text FilePath: The path of a file.
text Text: The text that should be stored in the file.
1/0 AppendMode: Whether or not the text should be appended at the end of an existing file (1 = append, 0 = don't append)

Call this function to save text in a file.

Example:

// Save the autoexec.bat file
StrToFile("
C:\\autoexec.bat", "Copy a.ini b.ini")

StrUpper(text VariableName)

This function has one required parameter:
text VariableName: The name of the variable to convert to upper case characters

Call this function to covert all lower case characters of a string to upper case characters.

Example:

// Fill the text variable
SetVariable("var", "John")
// Convert all the characters in the string to upper case characters
StrUpper("var")
// And we show the name; notice 'JOHN' is now in upper case
Prompt("%var%")

SynchFiles(text SourcePath, text DestinationPath, text/number Option = 3 )

This function has two required parameters, and one optional parameter:
text SourcePath: The path of the source (you can use wildcards)
text DestinationPath: The path of the destination
text/number Option: flag to indicate when the destinatin file should be overwritten (when there is already one). i.e. 0 = always, 1 = newer source-version, 2 = newer source-time, 3 = newer source-version OR newer source-time, 4 = newer source-version AND newer source-time

Use this function to copy some files from one location to another, depending on the version and/or date-time info of the source file. NOTE: Version info is usually only included in binary files like executables, or DLL's .

Example:

// We need to know the 'My Macros' folder
LoadSystemVariables()

// Copy all macro scripts from a central folder to the local 'My Macros' folder
// Only overwrite the destinatin files that are older
SynchFiles("E:\\Central Macros\\*.mma", "%FOLDER_MYMACROS%", 2)

TimeoutPrompt(text Message = "", text Title = "Tronan Macro", text/number StyleFlags = 0, text/number TimeoutMilliSeconds = 10000, text/1/0 ShowCountdown = 1)

This function is the same as the function Prompt, but it has two additional optional parameters:
text/number TimeoutMilliSeconds: The maximum number of miliseconds to wait for a new window to appear
text/1/0 ShowCountdown: Whether or not the seconds should be visualy count down (1 = show count down, 0 = do not show count down)

This function is the same as the Prompt command. But this one will automatically close the box after a certain amount of time. Look at the Prompt command for more details.

Example:
// Show some message for 5 seconds
TimeoutPrompt("
This box will close automatically after 5 seconds", "Tronan Macro", 0, 5000)

Unzip(text ArchivePath, text ExtractPath, text Files, text Options = "")

This function has three required parameters and one optional parameter:
text ArchivePath: The path of the zip file
text ExtractPath: The path of the root (to which all other file paths will be considered relative)
text Files: A list of files to extract from the archive. The files should be separated by a comma (wildcards are allowed).
text Options: Unzip options. There are currently 2 options supported: -o = overwrite (files that already exist are replaced), and -pBUNNY = password protected (where BUNNY is the password used to encrypt the archive).

Use this function to extract files form a zip file.

Example:
// The following macro unzips all text files and logs (to the root)
Unzip("C:\\TextFilesAndLogs.zip", "C:\\", "*.txt, *.log", "-pItsMe -o")

Wait(text/number MilliSeconds, text/number SequenceSpeedDependent = 0)

This function has one required, and one optional parameter:
text/number MilliSeconds: Amount of time (in milliseconds) to suspend the execution of the Macro script
text/number SequenceSpeedDependent: Whether or not (0 = no, 1 = yes) the wait time should be dependent of the SetSequenceSpeed setting.

Use this function to suspend the execution of the Macro script for a while.

Example:
// Show some message
Prompt("
Some message")
// Wait for 2 seconds
Wait(
2000)
// Show another message
Prompt("
Another message")

WaitForInternet(text/number LoadedValue = 1, text/1/0 StopLoadingOnHit = 0, text/number MaxWaitInMilliSeconds = 30000)

This function has three optional parameters:
text/number LoadedValue: Wait until the Tronan Browser has loaded this amount of items
text/1/0 StopLoadingOnHit: If the Tronan Browser should stop loading once this command is finished waiting
text/number MaxWaitInMilliSeconds: The maximum amount of time the command is allowed to wait

Call this function to ensure the Tronan Browser has loaded a certain amount of an internet page, before continuing with the rest of the script. Normally it would be very difficult to create a macro for the Internet, since you can not predict how long it will take for a page to load. When you use the Tronan Browser and the WaitForInternet command, however, this is not a problem anymore.

Example:
// Open the Tronan Browser with the RSI-Shield URL
Internet("
http://www.rsishield.com")

// Wait for the RSI-Shield page to load
WaitForInternet(2)

// Select the download 'button' (the seventh element) on the page
SendKeys("[TAB:7]")

// Push the download button
SendKeys("
[ENTER]")

WaitForWindow(text WindowTitle = "", text/number MaxWaitInMilliSeconds = 30000)

This function has two optional parameters:
text WindowTitle: The title (or a part of the title using the * symbol) of the window to wait for (or, if you prefix the word CLASS:, the function will look for the class name iso the title)
text/number MaxWaitInMilliSeconds: The maximum amount of time to wait for the window to appear

Use this command to ensure a certain window is on the foreground.

NOTE: If you do not provide a WindowTitle at all, the command will wait for just any window to appear. What this actually does is that it will compare the current foreground window with the foreground window at the time MarkActiveWindow was called. If the two foreground windows are two different ones. The WaitForWindow will stop waiting. The function MarkActiveWindow will be called automatically at the beginning of a Macro Script and after each ..WaitForWindow.. type function.
You can prefix the word CLASS: in front of the title name, and the function will look at the window-class names i.s.o. the window title.

Example 1:
// MarkActiveWindow is called implicitly..

// Start notepad and wait for it (a new window) to appear
ExecuteAndWaitForWindow("notepad.exe")
// MarkActiveWindow is called implicitly..

// Enter this sentence into notepad
SendKeys("This will be entered into notepad")

// Start the calculator
Execute("calc.exe")

// Wait for it to appear
WaitForWindow()

// Enter a calculation into the calculator
SendKeys("1+4[ENTER]")


Example 2:
// Wait until Microsoft Word appears in the foreground
WaitForWindow("
*Microsoft Word*")

Example 3:
// Wait until the Notepad appears in the foreground
WaitForWindow("
CLASS:notepad")

Zip(text ArchivePath, text RootPath, text Files, text Options = "")

This function has three required parameters and one optional parameter:
text ArchivePath: The path of the zip file
text RootPath: The path of the root (to which all other file paths will be considered relative)
text Files: A list of files to add to the archive. The files should be separated by a comma (wildcards are allowed).
text Options: Zip options. There are currently 4 options supported: -m = move into (files are deleted from disk and placed into the archive), -pBUNNY = password protected (where BUNNY is the password used to encrypt the archive), -d = delete (don't add them) the provided files from an existing archive, and -r = recurse directories.

Use this function to create a 100% Winzip compatible zip archive.

Example:
// The following macro zips all text files and logs (that are in the root), and
// and protects them by password 'ItsMe'

Zip("C:\\TextFilesAndLogs.zip", "C:\\", "*.txt, *.log", "-pItsMe")

 

General Information - General Functions A-R - Flow Control Functions