This language reference provides informations, examples and syntax-rules on every instruction and function RapidBATCH 4.4 provides.
1. Variables- and Control-Instructions
1.1
DEC var1,var2,var3 ... varn
|
Description:
Declares one ore more new variables in the script.
|
Example:
dec [a], [b]
|
Notes:
It is not recommended to declare variables explicity before their usage in RB4. Dec can be used optionally.
|
1.2
IF condition instruction
IF condition
{instruction block}
[ELSEIF condition
{instruction block}]
[ELSE
{instruction block}]
ENDIF
|
Description:
The IF-instruction allows for conditional processing. It lets you compare values and runs any RapidBATCH instruction if the result of the comparison is TRUE. Alternative to only one instruction, an instruction-block can be specified that is closed by the next ENDIF-instruction. Those IF-constructions can also have an ELSEIF-block, that can verify another condition (if the first IF or prior ELSEIF failed), or ELSE-block which is executed if the condition's result is false. There can be only one IF and only one ELSE in one IF-block. ELSEIF-blocks can be specified in any amount.
In RapidBATCH, a condition is a comparison of two values. The programmer is able to compare to equal (=), not-equal (!), greater-than (>) and lower-than (<), whereas latter can only be used with numerical values. You can compare two variables, a variable with a constant value or two constant values (which is not very sensefull).
To verify more than one conditon in one IF, you can use the logical operators AND (&) and OR (|). The &-operator returns only TRUE, when all conditions linked with this operator succeded. The |-operator succeeds only when one of the conditions return TRUE. Please refer the examples below.
|
Example:
if [a] = [b] echo 'A is equal to B!'
if [password] = 'swordfish'
echo 'Login accomplished.'
[admin] = 'false'
elseif [password] = 'master'
echo 'You have administrational rights.'
[admin] = 'true'
else
echo 'False password!'
halt
endif
if [a] < '10'
echo 'Error!'
halt
endif
rem Logical AND-operator succeeds only when both
rem variables contain the value 10
[a] = '10'
[b] = [a]
if [a] = '10' & [b] = '10'
echo 'A and B are both containing 10!'
endif
rem Logical OR-operator succeeds only when one of the
rem variables contains the value 10
[a] = '11'
[b] = '10'
if [a] = '10' | [b] = '10'
echo 'A or B contains 10!'
endif
rem More complex structure of AND- and OR-operators
if [a] = '10' & [b] = '10' | [a] = '9' & [b] = '12'
echo 'Running Calculator...'
call 'c:\windows\calc.exe', 'show'
echo 'Continuing...'
endif
|
Notes:
IF-blocks can be combined in any order.
|
1.3
HALT
|
Description:
Stops the script immediatelly.
|
Example:
halt
|
Notes:
none.
|
1.4
REPEAT ... UNTIL condition
|
Description:
With REPEAT and UNTIL, you're able to construct loops, that repeat a block of instructions until the specified condition is verified to true.
In RapidBATCH, a condition is a comparison of two values. The programmer is able to compare to equal (=), not-equal (!), greater-than (>) and lower-than (<), whereas latter can only be used with numerical values. You can compare two variables, a variable with a constant value or two constant values (which is not very sensefull).
To verify more than one conditon in one REPEAT...UNTIL-loop, you can use the logical operators AND (&) and OR (|). The &-operator returns only TRUE, when all conditions linked with this operator succeded. The |-operator succeeds only when one of the conditions return TRUE. Please refer the examples below.
|
Example:
rem This script counts a value from 0 to 10
[i] = 1
repeat
echo 'Value: ' # [i]
calcvar [i] = [i] + '1'
until [i] > '10'
rem Loop using logical operators to abort
[a] = '0'
[b] = '0'
repeat
calcvar [a] = [a] + '1'
calcvar [b] = [b] + '2'
until [a] > '10' & [b] > '20'
|
Notes:
REPEAT...UNTIL-loops can be combined in any order.
|
1.5
GOTO label
|
Description:
GOTO jumps to a specified label in the script. This possibility allows you to write ultra-complex scripts. A label is specified in the script with a beginning %-character.
|
Example:
%test
.
.
.
goto test
|
Notes:
The label specified at GOTO may not begin with the %-character.
|
1.6
GOSUB label .. RESUME
|
Description:
Same as GOTO, GOSUB jumps to a specified label in the script. The difference to GOTO is, that GOSUB jumps to a label, in this case a sub-program, and executes all code until the next RESUME-instruction. Then, the RESUME-instruction returns to the line behind the last GOSUB-call. This possibility allows you to write ultra-complex scripts. A label is specified in the script with a beginning %-character. GOSUB...RESUME constructions can be combined into complex srtructures of sub-program calls.
|
Example:
[i] = 1
repeat
gosub square
calcvar [i] = [i] + '1'
until [i] > '10'
halt
%square
calcvar [x] = [i] * [i]
echo [i] # ' * ' # [i] # ' = ' # [x]
resume
end
|
Notes:
If no RESUME is given, the GOSUB does the same like a GOTO.
|
1.7
WAIT millisec
|
Description:
Stops the script until the specified amount of milli-seconds had passed.
|
Example:
wait '5000'
echo 'Hello World ;)'
|
Notes:
none.
|
1.8
REM comment
|
Description:
REM allows you to comment your script. By the way, REM has no function, it just tells the compiler/interpreter that it should ignore all characters behind this instruction until the next line-break.
|
Example:
rem Ask user if he want to continue
confirm [conf] = 'Do you want to continue?'
|
Notes:
none.
|
2. User dialogs
2.1
MSGBOX title, message, buttons
|
Description:
MSGBOX lets the script programmer display a customized messagebox-dialog. MSGBOX expects a title, a message text and a so called style. Its possible to let a numerical value for the style (that allows more options) or RapidBATCH's build-in constants, e.g. OK or YESNOCANCEL. The list below shows the possible button types you can use. Which button has been pressed is saved to the variable [errorcode] (see return values in the list).
| Buttonvalue: |
Buttons (with return values): |
| 0 (ok) |
OK (1) |
| 1 (okcancel) |
OK (1) + CANCEL (2) |
| 2 (cancelretryignore) |
CANCEL (3) + RETRY (4) + IGNORE (5) |
| 3 (yesnocancel) |
YES (6) + NO (7) + CANCEL (2) |
| 4 (yesno) |
YES (6) + NO (7) |
| 5 (retrycancel) |
RETRY (4) + CANCEL (2) |
You can also use a customized icon in a message box. Calculate the button type, e.g. 4 for YES-NO and add the value 16, 32, 48 or 64 to it (so you assign e.g. 36 as buttontype). The result is a messagebox with YES-NO-Buttons and a question-mark icon. Return values are the same.
|
Example:
msgbox 'Hello!', 'Hello, deat script user!', 'ok'
msgbox 'Exit script?', 'Do you really want to exit the script?', 'yesno'
if [errorcode] = '7'
halt
else
goto start
endif
|
Notes:
In RapidBATCH 3.0, this instruction has been called ECHOBOX. The old instruction is also possible to be compatible with RB 3.x and 2.x.
|
2.2
ECHO message
|
Description:
ECHO is a shortcut for a simple messagebox-dialog with OK-Button and Info-Icon.
|
Example:
echo 'Hello World'
echo [text]
|
Notes:
To change ECHO's standard title for the messagebox (default: "RapidBATCH Echo"), change its
value using the pre-declared variable [Echo_Title].
|
2.3
CONFIRM result = message
|
Description:
CONFIRM is another shortcut for a messagebox-dialog with YES-NO-Buttons. If the user presses YES, the result-variable gets the value 0, else -1.
|
Example:
confirm [res] = 'Do you really want to quit?'
if [res] = '0' halt
goto new
|
Notes:
To change CONFIRM's standard title for the messagebox (default: "RapidBATCH Confirmation"), change its value using the pre-declared variable [Confirm_Title].
|
2.4
INPUTBOX var = title, prompt, pre-text
|
Description:
INPUTBOX shows a simple input dialog where the user can enter data. INPUTBOX expects a variable that gets the value the user entered, a title, a prompting text and a previewed text shown in the edit field.
|
Example:
inputbox [name] = 'Login', 'Please enter your login name:', 'Anonymous'.
if [name] ! 'Anonymous'
inputbox [password] = 'Password', 'Please enter password:', ''.
if [password] ! 'swordfish'
halt
else
[loginstatus] = 'user'
endif
else
[loginstatus] = 'guest'
endif
|
Notes:
If the user hits the CANCEL-Button, the return value is an empty string.
|
2.5
EDITBOX var = title, text, mode
|
Description:
The EDITBOX-function provides a dialog with a multi-line edit-field and "Ok" and "Cancel" buttons. In this dialog, the user can view or edit greater amounts of text.
The function expects a return-variable (which is, as the case may be, the by the user edited text) a dialog-title, the text displayed in the edit field and a show mode, which can be 0 (or WRITEABLE) or 1 (or READONLY). If you assign WRITEABLE as showmode, the text can be edited, else it can only be viewed (READONLY-mode).
|
Example:
editbox [text] = 'Edit', 'Edit any text into this field.', 'writeable'
editbox [text] = 'View', 'This text cannot be modified.', 'readonly'
|
Notes:
If the user hits the CANCEL-Button, the return value is an empty string. You can individualize the EDITBOX-dialog over the pre-declared variables [EditBox_Width], [EditBox_Height], [EditBox_Ok] and [EditBox_Cancel].
|
2.6
LISTBOX var = title, list
|
Description:
The LISTBOX-function allows the user to make a choice from a list of options, e.g. in a menu or a file list. Return-value of the function is the chosen entry or, if no entry was selected, an empty string. As parameters, the function expects beneath the return-variable a dialog-title and the list of the entries, which is specified as a string, where each entry is seperated by a pipe-character (|), e.g. "First Entry|Second Entry|Third Entry|...".
If the user hits the dialog's close-button or the "Ok"-button without choosing an entry, the return value is an empty string.
|
Example:
listbox [food] = 'Yummy!', 'Pizza|Hamburger|Fries|Pita'
if [food] ! ''
echo 'Ah, you are a ' # [food] # ' eater ;) ...'
endif
end
|
Notes:
You can individualize the LISTBOX-dialog over the pre-declared variables [ListBox_Width], [ListBox_Height] and [ListBox_Ok].
|
|
2.7 OPENBOX filename = title, filter
|
Description:
Shows the Windows Standard Dialog to choose a file. OPENBOX expects a variable which gets the choosen filename, a title and a so called file filter.
A filter is specifiled as a string that looks like
'Text files|*.txt'
Or for more than one file types:
'Text files|*.txt|HTML-Files|*.html|DOC-Files|*.doc' ...
First, the file label that is shown in the fiype dropdown-box must be specified, then the filter type, all sepereated by pipe-characters (|).
|
Example:
openbox [file] = 'Open a file','Text files|*.txt|All Files|*.*'
|
Notes:
Use the SAVEBOX-instruction to show the Windows-standard save dialog. When you set the pre-declared variable [OpenBox_MultiSel] to 0, you can choose more than one file from the directory. In such a case, a file list is returned that begins with the directory that contains the files and the list of files, each seperated by a pipe-character (|). An example: "c:\my files|test.txt|hello.txt|myfile.txt" if the user chose the files TEST.TXT, HELLO.TXT and MYFILE.TXT from the directory C:\MY FILES.
|
|
2.8 SAVEBOX filename = title, filter
|
Description:
Shows the Windows Standard Dialog to choose a file. SAVEBOX expects a variable which gets the choosen filename, a title and a so called file filter.
A filter is specifiled as a string that looks like
'Text files|*.txt'
Or for more than one file types:
'Text files|*.txt|HTML-Files|*.html|DOC-Files|*.doc' ...
First, the file label that is shown in the filetype dropdown-box must be specified, then the filter type, all sepereated by pipe-characters (|).
|
Example:
savebox [file] = 'Open a file','Text files|*.txt|All Files|*.*'
|
Notes:
Use the OPENBOX-instruction to show the Windows-standard open dialog. When you set the pre-declared variable [SaveBox_MultiSel] to 0, you can choose more than one file from the directory. In such a case, a file list is returned that begins with the directory that contains the files and the list of files, each seperated by a pipe-character (|). An example: "c:\my files|test.txt|hello.txt|myfile.txt" if the user chose the files TEST.TXT, HELLO.TXT and MYFILE.TXT from the directory C:\MY FILES.
|
|
2.9 FOLDERBOX folder = prompt, pre-selection
|
Description:
Shows the Windows Standard Dialog for a folder choice.
FOLDERBOX expects a result-variable, that gets the path of the chosen folder, a prompting text and a pre-selection, that can also be an empty string.
If the user hits "Cancel", an empty string is returned.
|
Example:
folderbox [f] = 'Please choose a folder:', 'c:\jmksf'
|
Notes:
none.
|
|
2.10 INFOBOX infotext, mode
|
Description:
The INFOBOX-dialog is a RapidBATCH build-in window to view status informations to the user. The dialog can be shown until some other operations are executed. The script-programmer needs to view or hide the dialog in the desired order. The dialog is always shown in the foreground of all other running windows applications and can not be set to the background.
The instruction expects the desired infotext and the mode, if the window is shown or not (0 = show, -1 = hide). To set the view/hide status, you can also use the variable [InfoBox_Enabled].
|
Example:
infobox 'The script waits for 5 seconds now...', 'show'
wait '5000'
[InfoBox_Enabled] = '-1'
|
Notes:
Use the variables [InfoBox_Width] and [InfoBox_Height] to change the width and height of the infobox-dialog, e.g. to display multi-line messages or something like that.
|
3. Functions
3.1
CALCVAR result = value1 +|-|*|/|~ value2 ... valueN
|
Description:
The CALCVAR-function performs calculations on variables and constant values, if they contain numerical contents. You can use the four standard arithmetic operatiors + for addition, - for substraction, * for multiplication and / for division. You can also use the modulo-operator (~) for integer numbers (modulo returns the carryover of a division, e.g. 10 modulo 4 returns 2).
|
Example:
calcvar [c] = [a] + [b]
calcvar [x] = '10' * [n] / '4' - '77' * '3.5'
calcvar [res] = '10' ~ '4'
|
Notes:
Modulo is only supported in RapidBATCH 4.3 and higher.
|
3.2
UPVAR result = value
|
Description:
Converts the specified value to upper cases and returns the converted string.
|
Example:
upvar [uppername] = 'hello world'
|
Notes:
Use the LOWVAR-function to convert a string to lower cases.
|
3.3
LOWVAR result = value
|
Description:
Converts the specified value to lower cases and returns the converted string.
|
Example:
lowvar [uppername] = 'HELLO WORLD'
|
Notes:
Use the UPVAR-function to convert a string to upper cases.
|
3.4
TRIMVAR result = value
|
Description:
The function TRIMVAR deletes all blanks from in front of and behind a string.
|
Example:
trimvar [a] = ' hello world '
|
Notes:
none.
|
3.5
GETCHR result = ascii-code
|
Description:
Returns the ASCII-character to the specified ASCII-code.
|
Example:
rem Returns a qoutation mark (&qout;)
getchr [quot] = '034'
|
Notes:
Use GETASC to get an ASCII-code by its character.
|
3.6
GETASC result = ascii-character
|
Description:
Returns the ASCII-code number of the given ASCII-character.
|
Example:
rem Returns 65 as ASCII-code value
getasc [a_code] = 'A'
|
Notes:
Use GETCHR to get an ASCII-character by its ASCII-code.
|
3.7
GETLEN result = value
|
Description:
Returns the length in characters of the sepcified value.
|
Example:
getlen [len] = 'Hello World'
|
Notes:
none.
|
3.8
COPYVAR result = value, from, to
|
Description:
Extracts a substring from the specified value, that begins at character from and ends at character to. The result is the copied sub-string.
|
Example:
copyvar [n] = [name], '5', '10'
|
Notes:
In RapidBATCH v4.3: When the value -1 is assigned to the from-parameter, the character number specified at the to-parameter are returned from the right of the string.
|
3.9
GETPOS position = value, substr, count
|
Description:
Returns the position of the value substr that is appearing at the as count-parameter specified appearance-number in the specified string. If the value does not include the sub-string, the result value is 0.
|
Example:
rem In this example, [pos] gets the value 3
getpos [pos] = 'Hello World', 'llo', '1'
rem And here it gets a value of 13
getpos [pos] = 'Hello World Hello Computer', 'Hello' ,'2'
|
Notes:
none.
|
3.10
GETTOK token = value, delimiter-string, count
|
Description:
The tokenizer-function GETTOK returns a so called token from a string. A token is a sub-string, speerated by a special delimiter-character (or delimiter-string) from other tokens. When GETTOK is executed, it returns the token positioned as the as count-parameter specified token-position in the string.
|
Example:
rem This example extracts all files from a string returned by the FINDFILES-function.
rem As delimiter-character we use the pipe-character (|).
chdir 'c:\jmksf\rb4'
findfiles [files] = '*.exe', '1'
[count] = 1
repeat
gettok [tok] = [files], '|', [count]
if [tok] ! ''
echo 'Token at position ' # [count] # ' is: ' # [tok]
endif
calcvar [count] = [count] + '1'
until [tok] = ''
end
|
Notes:
If the end of the string is reached, GETTOK returns all tokens that had been read until the string-end.
|
3.11
REPLACEVAR result = string, substring1, substring2
|
Description:
The function REPALCEVAR replaces each substring1 appearing in the String string by the parameter substring2. Return value is the modified string.
|
Example:
rem This example replaces all pipe-characters (|) appearing in the file-list returned
rem by the FINDFILES-function with line-breaks (specified in the [new_line]-variable)
rem and displays the file-list in a messagebox.
chdir 'c:\jmksf\rb4'
findfiles [files] = '*.exe', '1'
replacevar [files] = [files], '|', [new_line]
echo 'Content of ' # [current] # [new_line] # [new_line] # [files]
end
|
Notes:
none.
|
3.12
RANDVAR var = maxval
|
Description:
Generates a randomized number that is between 0 and the specified value maxval - 1.
|
Example:
rem Return randomized number between 0 and 255...
randvar [random] = '255'
echo 'Random-number: ' # [random]
|
Notes:
none.
|
4. System-specific operations and file handling
4.1
CHDIR path
|
Description:
Changes to the specified directory.
|
Example:
chdir 'c:\jmksf'
|
Notes:
If the operation has been successfull, the variable [errorcode] gets the value 0, else -1. Use MKDIR and RMDIR to create or remove directories.
|
4.2
MKDIR path
|
Description:
Creates a new, specified directory.
|
Example:
mkdir 'c:\jmksf\test'
|
Notes:
If the operation has been successfull, the variable [errorcode] gets the value 0, else -1. Use CHDIR and RMDIR to change or remove directories.
|
4.3
RMDIR path
|
Description:
Removes the specified, empty (important!) directory. It is not possible to remove directories which contain files with RMDIR.
|
Example:
rmdir 'c:\jmksf\test'
|
Notes:
If the operation has been successfull, the variable [errorcode] gets the value 0, else -1. Use MKDIR and CHDIR to create or change directories. To delete a directory, call the FINDFILES-function using the '*' filter in a loop and delete every file with DELFILE.
|
4.4
SYSTEM command
|
Description:
Executes an operating system command (DOS-commands). The script cannot run further before the SYSTEM-instruction finished its command.
|
Example:
system 'dir >list.txt'
|
Notes:
[errorcode] gets -1 if no COMMAND.COM or CMD.EXE was found.
|
4.5
SHELL program, showmode
|
Description:
Executes an external program.
If you run a program with SHELL, the own script runs further (multitasking).
program specifies the file name of the program that should be startet, showmode a so called show mode. Possible are the values SHOW (0), HIDE (1), MAXIMIZED (2) and MINIMIZED (3).
|
Example:
shell 'c:\windows\calc.exe', 'show'
shell 'c:\windows\desktop\test.bat', 'hide'
|
Notes:
[errorcode] gets the program's return value. If this is >32, the program has been started sucessfully. Please use the CALL-instruction to run a program in modal mode (script stops until the started program is terminated).
|
4.6
CALL command, showode
|
Description:
Runs a program in modal-mode. That means, that the script waits until the program, which had been started by CALL, terminates. CALL expexts, same as SHELL, a showmode, which can be a value of SHOW (0), HIDE (1), MAXIMIZED (2) and MINIMIZED (3).
|
Example:
call 'c:\windows\calc.exe', 'show'
|
Notes:
[errorcode] gets -1, if an error occured, else the return-value of the called program.
This instruction was extended in RapidBATCH v4.3 to the showmode-parameter that was desired by many RB4-customers. The old syntax style is not possible anymore.
|
4.7
OPEN data
|
Description:
Opens a specified file with the associated program or loads an internet-URL into the browser. OPEN can also execute external programs like SHELL.
|
Example:
open 'hello.rb'
open 'http://www.jmksf.com'
open 'c:\windows\calc.exe'
|
Notes:
none.
|
4.8
NEWFILE filename
|
Description:
Creates a new, empty file.
|
Example:
newfile 'c:\windows\desktop\hello.txt'
|
Notes:
If the file has been created successfully, [errorcode] gets 0, else -1.
|
4.9
DELFILE filename
|
Description:
Deletes the specified file. [errorcode] gets 0 if the operation has been sucessfull, else -1.
|
Example:
delfile 'c:\temp\info.txt'
|
Notes:
none.
|
4.10
COPYFILE source, target
|
Description:
Copies the file source to the file target.
|
Example:
copyfile 'c:\jmksf\rbatch32\samples\hello.rb', 'a:\hello.rb'
|
Notes:
[errorcode] gets 0 if the operation has been successfull, else -1.
|
4.11
RENAMEFILE source, target
|
Description:
Renames the file source into the file target.
|
Example:
renamefile 'c:\test.txt', 'c:\test.old'
|
Notes:
With RENAMEFILE, you can also move files to other directories. [errorcode] gets 0 if the operation succeeded, else -1.
|
4.12
FILEEXISTS result = filename
|
Description:
Verifies if the specified file exists or not. The returned value is 0 if the file does exist, else -1.
|
Example:
fileexists [res] = 'c:\windows\calc.exe'
if [res] = '0'
echo 'CALC.EXE does exist :) ...'
else
echo 'CALC.EXE does NOT exist :( ...'
endif
|
Notes:
none.
|
4.13
WRITEFILE filename, value
|
Description:
Writes the specified value to the specified file. The value is appended to the file's end, so that the files content won't be overwritten.
|
Example:
writefile 'c:\test.txt', 'Hello World'
|
Notes:
If the specified file does not exists, it will be automatically created.
|
4.14
READFILE result = filename, line
|
Description:
Reads the specified line from the specified file, and returns this. If the file end is reached or if the file couldn't be found, [errorcode] gets -1 and the return value is "EOF".
If the assigned line-number is lower than 1, READFILE reads the whole file content with a limit of 32k and returns it.
|
Example:
rem Read first line of the file...
readfile [text] = 'c:\test.txt', '1'
rem Read whole file...
readfile [text] = 'c:\test.txt', '0'
|
Notes:
Improoved in RapidBATCH 4.4: READLINE can now read a maximum line length of 32k (32768 bytes), not only 1024 than before.
|
4.15
MCI mci-string
|
Description:
Sends an mci-command string to the Windows® Multimedia Control Interface. This possibility lets you play nearly any type of media file, e.g. WAV, MOV, MIDI, MP3, AVI ...
|
Example:
rem Simple MP3-player
mci 'open music.mp3'
mci 'play music.mp3'
wait '5000'
mci 'close music.mp3'
|
Notes:
Please view the help file MCI.HLP in the \DOC-directory of your RB4 setup directory to get a list of possible MCI-commands and functions. [errorcode] tells you the return-value of the WinAPI mciSendString()-function.
|
4.16
GETENV var = env_var
|
Description:
Gets the value of an environment variable.
|
Example:
getenv [pathvar] = 'PATH'
|
Notes:
Set envionment variables with the LETENV-instruction.
|
4.17
LETENV env_assignment
|
Description:
Sets an existing environment variable, or creates a new one.
|
Example:
letenv 'HELLO=Hello World'
|
Notes:
Environment-variables which are created by a script will be autmatically deleted by the operating system when the script halts. Get environment variables with the GETENV-instruction.
|
4.18
SENDKEYS program_window, keystrokes
|
Description:
The SENDKEYS-instructions simulates keystrokes and hotkeys on the window with the text program_window in its title bar. This instruction allows to control any other Windows®-application by the script, using a simple macro language assigned as the keystrokes-parameter.
Standard keys (letters, numbers) can directly be specified. Special keys can be assigned as hotkeys or over their keycodes. To specifiy a hotkey, use the hotkey-identifier, beginning with a tilde (~) and the identifier, from the list below. For any other special-keys or for shortcuts (e.g. ALT+F4) use keycodes, beginning with a hash (#) and the according keycode. A list of all available keycodes can be found in the file KEYCODES.TXT in the \DOC-directory of the RB4 setup-directory.
| Hotkey: |
Meaning/Key: |
| r |
Enter, Return |
| t |
Tabstop |
| a |
ALT |
| c |
Shift |
| b |
Backspace |
| U |
Up-Key |
| D |
Down-Key |
| L |
Left-Key |
| R |
Right-Key |
| 1 |
F1-Key |
| 2 |
F2-Key |
| 3 |
F3-Key |
| 4 |
F4-Key |
| 5 |
F5-Key |
| 6 |
F6-Key |
| 7 |
F7-Key |
| 8 |
F8-Key |
| 9 |
F9-Key |
| A |
F10-Key |
| B |
F11-Key |
| C |
F12-Key |
| ~ (means: ~~) |
~-character |
|
Example:
rem Please check/modify the title line of Notepad in your
rem Windows®-version when copying this example.
shell [windir] # '\notepad.exe', 'show'
sendkeys 'Untitled - Notepad': 'Hello World#272fs#018test.txt~r#272~4#018'
end
|
Notes:
[errorcode] gets -1 if window with the specified text in its title-var coudn't be found, else 0.
|
4.19
FINDFILES file = filter, level
|
Description:
The FINDFILES-function reads the content of the current directory (including sub-directories if neccessary) and returns a list of files, seperated by pipe-characters (|).
The function expects as parameters a file-fiter (which can use * and ? wildcards) and a level-depth value, that allows to read a directory with sub-directories until a given sub-directory depth.
|
Example:
rem List all EXE-files containied by C:\JMKSF...
chdir 'c:\jmksf'
findfiles [filelist] = '*.exe','0'
replacevar [filelist] = [filelist], '|', [new_line]
echo [filelist]
rem List all files in the directory C:\JMKSF\RB4 without sub-directories
chdir 'c:\jmksf\rb4'
findfiles [filelist] = '*.*','1'
replacevar [filelist] = [filelist], '|', [new_line]
echo [filelist]
end
|
Notes:
If the value 0 is specified as level, FINDFILES lists all files of the current directory until a subdir-level of 255 (which is an immense high depth). If the value 1 is specified, it lists all files in the current directory, if 2 is specified, it lists all files of the current directory and all files in the sub-directories of the directory up to one level, and so on.
To extract files from a file-list returned FINDFILES, use the functions GETTOK and REPLACEVAR.
|
4.20
FILESIZE result = file
|
Description:
Returns the size, in bytes, of the specified file.
|
Example:
filesize [bytes] = 'c:\autoexec.bat'
|
Notes:
none.
|
4.21
GETFILEATT status = filename, attribute
|
Description:
The GETFILEATT-function provides informations if a secified file attribute of the specified file is enabled or not. Possible attributes are NORMAL (0), ARCHIVED (1), READONLY (2), COMPRESSED (3), DIRECTORY (4), HIDDEN (5) and SYSTEM (6). You can also use the identifiers, such as ARCHIVED or READONLY instead of the numerical values.
Return value of the function is 0 if the asked attribute is set, else -1.
|
Example:
[file] = ..\readme.txt
[i] = 0
repeat
getfileatt [ret] = [file],[i]
[res] = [res] # [i] # ' = ' # [ret] # [new_line]
calcvar [i] = [i] + '1'
until [i] = '7'
echo 'File Attributes of ' # [file] # [new_line] # [new_line] # [res]
|
Notes:
none.
|
4.22
LETFILEATT filename, attribute
|
Description:
The LETFILEATT-instruction sets the specified attribute of the specified file to enabled. You can use the same attributes and their identifiers that are possible at GETFILEATT, but you can not set the modes COMPRESSED (3) or DIRECTORY (4) to a file.
|
Example:
letfileatt 'c:\jmksf\rb4\readme.txt', 'readonly'
letfileatt 'c:\temp\x.tmp', 'hidden'
|
Notes:
[errorcode] gets -1, if an error occured, else 0.
|
5. Debugger control instructions
5.1
DEBUGMODE mode
|
Description:
Switches the build-in debugger to one of three modes. Possible values are STEP for step-by-step debugging, TRACE for trace-debugging and NONE for no debugging.
|
Example:
debugmode step
debugmode trace
debugmode none
|
Notes:
The startup-debug mode can also be set using the environment-variables RB_DEBUGMODE with the same values as the instruction.
|
5.2
DEBUGVARS varlist
|
Description:
Adds variables to the debugger's variable monitoring list. You can assign a list of variables to this instruction (same as like the DEC-instruction) or you can assign the mode AUTO, so that all declared variables are automatically monitored.
|
Example:
debugvars [a], [b], [hello]
debugvars auto
|
Notes:
You can also add variables on startup using the environment-variable RB_DEBUGVARS with the same values as the instruction.
|
6. Pre-declared Variables
6.1
[errorcode]
|
Description:
The [errorcode]-variable contains status values and is used by many instructions to brief if an error occured or, e.g. in a MSGBOX-dialog, which button has been pressed by the user. Refer the notes section of each instruction/function to get information which values [errorcode] may contain.
|
6.2
[command]
|
Description:
The variable [command] contains the command line parameters assigned to the script (at the interpreter directly behind the filename, in compiled scripts all parameters behind the executable filename).
|
6.3
[ownname]
|
Description:
Own filename of the script. In scripts executed by the interpreter, this is the name of the .RB-file, in compiled scripts the name and path of the .EXE-file.
|
6.4
[Echo_Title]
|
Description:
Title of an ECHO-messagebox.
Standard-value: "RapidBATCH Echo"
|
6.5
[Confirm_Title]
|
Description:
Title of a CONFIRM-messagebox.
Standard-value: "RapidBATCH Confirmation"
|
6.6
[current]
|
Description:
[current] contains the path of the current directory. You can change the directory by using the CHDIR-instruction.
|
6.7
[windir]
|
Description:
The Windows system directory path.
|
6.8
[time]
|
Description:
The system's time in the format hh:mm:ss
|
6.9
[day], [month], [year]
|
Description:
The system's date informations, splitted into three variables (for different/international date formatting)
|
6.10
[curuser]
|
Description:
In Windows NT, 2000 and XP the name of the current user who is logged in. In Windows 95, 98 and ME family logon, the value is "unknown".
|
6.11
[winvers]
|
Description:
The Windows-version. Possible values: 95, 95A, 95B, 95C, 98, 98SE, ME, NT4, 2000, XP and unknown, if there is a newer Windows-version than XP (e.g. Longhorn, Windows 2003 Server).
|
6.12
[IBox_Ok], [IBox_Cancel]
|
Description:
The caption of the OK- and Cancel-buttons in the INPUTBOX-dialog window.
|
6.13
[EditBox_Ok], [EditBox_Cancel],
[EditBox_Height], [EditBox_Width]
|
Description:
These variables allow to individualize the EDITBOX-dialog. With [EditBox_Ok] and [EditBox_Cancel], you're able to change the caption of the "Ok" and "Cancel" buttons; [EditBox_Height] and [EditBox_Width] allow to set a customized size of the dialog, in pixels.
|
6.14
[ListBox_Ok], [ListBox_Height], [ListBox_Width]
|
Description:
These variables allow to individualize the LISTBOX-dialog. With [ListBox_Ok], you're able to change the caption of the "Ok" button; [ListBox_Height] and [ListBox_Width] allow to set a customized size for the dialog, in pixels.
|
6.15
[OpenBox_MultiSel], [SaveBox_MultiSel]
|
Description:
Sets the OPENBOX- resp. SAVEBOX-dialog to the possibilty, that more than one files can be chosen. Set the variable to 0, and the user can choose more than one files in the according dialog, else, if the value is -1, he is able to choose only one file (value -1 is RapidBATCH standard for both variables).
|
6.16
[new_line]
|
Description:
A line break. This variable was only introduced to save the creation of an own line break variable with a GETCHR-call like
getchr [linebreak] = '10'
Because such a possibilty was desired by many users, it was implemented in RapidBATCH v4.1. For a line break in a string, you only need to catenate it together, e.g.
[hello] = 'Hello' # [new_line] # 'World'
will display
Hello
World
in the messagebox.
|
6.17
[clipboard]
|
Description:
Represents the Windows® system-clipboard. Data that is assigned to [clipboard] will be available globally for all applications. When you read the variable it contains the current content of the clipboard, e.g. a text copied by an application.
|
6.18
[InfoBox_Enabled], [InfoBox_Height], [InfoBox_Width]
|
Description:
These variables can indiviualize the INFOBOX-dialog. Use [InfoBox_Height] and [InfoBox_Width] to change the height and width of the dialog. [InfoBox_Enabled] enables or disables the dialog or tells if it's currently shown or not.
|
6.19
[RB_Version], [RB_Pro]
|
Description:
Contains the current RapidBATCH-version number. This allows to create scripts which can handle different codes (e.g. modern, old-styles).
WARNING: Using the variable with the compiler does not take any effect, that means you can get error-messages or deprecated warnings when compiling programs using older RapidBATCH 4 syntax and/or source parts.
The [RB_Pro] variable contains a value of 0 when the used edition of RapidBATCH is a Professional Edition, else it contains a value of -1.
|
<<< Back
|
|