commands.txt

(21 KB) Pobierz
This is a quick overview. Please read the manual (readme.txt) for details!

Syntax
======
Allowed parameter formats:
- "string"
  quoted string: contained whitespaces remain unmodified, use double quotes
  to include quotes (e.g. "This is ""quoted"""), ^CR^=carriage return,
  ^LF^=line feed, ^NL^=new line (Windows/DOS = ^CR^^LF^), ^TAB^=tabulator.
- variable
  contents of the variable
- expression
  result of the expression, e.g. "Variable = "&variable
- referred variables
  The (string) result of an expression in square brackets is used as variable name,
  e.g. [ some & "Array[" & idx & "]" ] could refer to the variable "myArray[42]".

For assignments (variable = expression), array indexes, and in expressions,f
percent signs around variables are optional (i.e., %x% = %y[%z%]% is the
same as x = y[z]), strings must be quoted.

For boolean parameters (yes/no, true/false), 1 is yes/true, 0 is no/false.
There are also these predefined variables:
ON, YES, TRUE = 1
OFF, NO, FALSE = 0
CANCEL = 2
PI = 3.1415...
PHI = 1.618...
EULERT = 2.7182... (e)
SQRT2 = 1.4142... (sqare root of 2)

Lines can be continued by using "\" as last character. Example:
Message message, \
        "Title"

Comments must start with "#" (trailing whitespaces are allowed). Example:
# This is a comment

Expressions
===========
Strings:   "any text, ""in quotes"""
Numbers:   123 (only integer operations!)
Variables: variable, array[index]

Operators by priority (highest first):
()        Brackets
NOT       Negation (True<->False)
^         Power (5^2=5*5)
* / MOD   Multiplication, division, modulo (remainder, integer only)
+ -       Addition, subtraction
& \       String concatenation (\ for paths)
>,  >=, <,  <=, =,  <>   Numerical comparsions
gt, ge, lt, le, eq, ne   Alphanumerical comparsions
c?a:b     If c is TRUE, evaluates to a, otherwise b
AND &&    Binary/logical and
OR  ||    Binary/logical or

Numerical and alphanumerical comparsions have same priority,
they're only splitted for better overview.
AND and OR use binary logic, i.e. 3 AND 7 will return 3 (111 AND 011 = 011),
while && and || use "C logic", i.e. everything that's not 0 is "true" (1), so
3 && 7 will return 1.

Available commands and functions
================================

If "<type> =" is used, it is a function. This means, it returns a value and must be
used in an expression (command parameter or condition). For example:
var = Input( "Enter value" )
If( wndExists( "Explorer" ) )
  ...
EndIf
Message( "Your input: " & Input( "Value:" ) )

Error handling
--------------
ErrorLevel( "off"|"critical"|"syntax"|"error"|"warn" )

Variables
---------
Set( <variable>,<expression> ) (better use <variable> = <expression>)
<variable> = <expression>
  also allowed: +=, -=, *=, /=, &=, \=; e.g. x/=2 meaning the same as x=x/2
Clear( <variable> )
bool   = IsEmpty( <variable> )
int    = VarType( <variable> ) - returns VAR_EMPTY, VAR_INT, VAR_FLOAT, VAR_STRING, or VAR_ARRAY
Local( [ <variable> {, <variable} ] )
Global( <variable> {, <variable} )

String operations
-----------------
string = Part( <string>,<seperator>,<index>[,<trim?>] )
int    = Length( <string> )
string = SubStr( <string>,<start>,<length> )
string = CharAt( <string>,<position> )
int    = Find( <string>,<search string>[,<start>] )
string = Replace( <string>,<search string>,<new string> )
int    = ReverseFind( <string>,<search character> )
string = ToUpper( <string> )
string = ToLower( <string> )
string = RepeatString( <string>, <count> )
string = UCChar( <unicode value> )
string = UCValue( <character> )

Math / floating point operations
--------------------------------
string = Format( <number>, <digits after decimal point> [, <min. digits before decimal point> ] )
string = NumberToHex( <number> )
int    = HexToNumber( <string with hex number> )
int    = Ceil( <number> [,<precision>] )
int    = Floor( <number> [,<precision>] )
int    = Round( <number> [,<precision>] ) (<.5 floor, >=.5 ceil)
float  = Sin( <radians> ) (radians = degree*PI/180)
float  = Cos( <radians> )
float  = Tan( <radians> )
float  = SinH( <radians> ) (hyberbolic)
float  = CosH( <radians> )
float  = TanH( <radians> )
float  = ArcSin( <radians> ) (arcus)
float  = ArcCos( <radians> )
float  = ArcTan( <radians> )
float  = Log( <number> ) (based to EULERT / "e")
float  = Log10( <number> ) (based to 10)
float  = Exp( <number> ) (same as EULERT ^ number)
float  = Sqrt( <number> ) (square root)
float  = Root( <number>, <exponent> ) (root to given exponent)
int    = CompareFloat( <number>, <number>, <precition> )
value  = Min( <value>, <value> {,<value>} )
value  = Max( <value>, <value> {,<value>} )

Array operations
----------------
Split( <string>,<seperator>,<trim?>,<variable>{,<variable>} ) (if only one variable, it's used as array)
array = Split( <string>,<seperator> [,<trim?>] )
string = Join( <array> [, <text between values>] )
array = Array( value {, value } )
array = Map( key, value {, key, value} )
int   = MaxIndex( array )  (last defined element with numerical index starting from 1)
int   = ElementCount( array ) (complete count of all elements, incl. alphanumerical indexes and cleared entries)
bool  = InArray( array, value )

Evaluate expressions in strings
-------------------------------
value  = Eval( <expression as string> ) (e.g. res = Eval("var" & index & " & ""...""") )

Execution
---------
Run( <application> [, <parameter>] )
RunWait( <application> [, <parameter>] )
New( <menu entry> ) (Windows Mobile only)

RunAt( <unix timestamp>, <application> [, <parameter>] )
RunAt( <year>, <month>, <day>, <hour>, <minute>, <application> [, <parameter>] )
RunOnPowerOn( <application> [, <parameter>] )
RemoveNotifications( <application> [, <parameter>] )

Window control
--------------
Show( <window title> )
Minimize( <window title> )
Close( <window title> )
window = ActiveWindow()
array  = FindWindows( [ <title> [, <search type> [, <case sens.?> [, <app window?>
                      [, <invisible?> [, <class name> ] ] ] ] ] ] )
window = FindWindow( [ <title> [, <search type> [, <case sens.?> [, <app window?>
                     [, <invisible?> [, <class name> ] ] ] ] ] ] )
bool   = WndActive( <window title> )
bool   = WndExists( <window title> )
WaitFor( <window title>,<seconds> )
WaitForActive( <window title>,<seconds> )
string = WindowText( <x>, <y> )
string = WndClass( <x>, <y> )
GetWindowPos( <window title>, <left>, <top>, <right>, <bottom> )
int    = WndLeft( <window title> )
int    = WndRight( <window title> )
int    = WndTop( <window title> )
int    = WndBottom( <window title> )

Sending keys
------------
SendKeys( [<window title>,]<string> )
SendSpecial( <key> [, <state> )
  Available keys (quoted string): Alt, Ctrl, Shift, CR, Win, Context, Tab, ESC, Space,
    Up, Down, Left, Right, Home, End, PageUp, PageDown, Delete, Backspace, Insert, Snapshot,
    F1 - F12, LeftSoft, RightSoft
  Availabe states (quoted string): up, down - omit parameter for short press
Send<special character> [ ( <window title>,<ctrl>,<shift> ) ]
  Special charaters: CR, Tab, Esc, Space, Backspace, Delete, Insert
                     Up, Down, Left, Right, Home, End, PageUp, PageDown,
                     LeftSoft, RightSoft, Win, Context
Snapshot [ ( <window title> ) ]
SendCtrlKey( [<window title>,]<key> )

Sending window messages
-----------------------
SendOK [ ( <window title> ) ]
SendCancel [ ( <window title> ) ]
SendYes [ ( <window title> ) ]
SendNo [ ( <window title> ) ]
SendCommand( [<window title>,] <command id> )
SendMessage( [<window title>,] <message id>, <wparam>, <lparam> ) (only numerical parameters supported!)
int = SendMessage( [<window title>,] <message id>, <wparam>, <lparam> ) (same as above as function)
PostMessage( [<window title>,] <message id>, <wparam>, <lparam> ) (only numerical parameters supported!)


Sending taps ("mouse events")
-----------------------------
MouseClick( [<window title>,]<x>,<y> )
MouseDblClick( [<window title>,]<x>,<y> )
MouseDown( [<window title>,]<x>,<y> )
MouseUp( [<window title>,]<x>,<y> )

PC version only: Prefix with "Middle" or "Right" for those buttons, e.g. RightMouseClick(...)

Waiting
-------
Sleep( <milliseconds> )
SleepMessage( <seconds>,<message>[,<title>[,<allowOK>[,<condition]]] )
WaitFor( <window title>,<seconds> )
WaitForActive( <window title>,<seconds> )

Time
----
int    = TimeStamp()      (local time as Unix timestamp)
int    = TimeStampUTC()   (UTC ...
Zgłoś jeśli naruszono regulamin