You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Represents a sequence of zero or more Unicode characters.
Number
Stores 64-bit floating-point values.
Comment
# This is a commentn=1+2# This is also a comment
Statements
Assign statement
n=1+2
Conditional branch statement (if, elif, else)
'...' represent for any statement.
if0<nandn<10
...
elifn==20orn==30
...
else
...
end# One linerifn==1 ... endifn==1 ... else ... endifn==1 ... elifn==2 ... else ... end# Can use alternative stylesifn==1: # ':' (Colon)
...
elifn==2then# 'then'
...
end
Loop statement (for, repeat)
foriin0to10*3# Loop 31 times
...
if ... breakendif ... continueendend# When a loop counter is unnecessaryrepeat10*3# Loop 30 times
...
end# Can use alternative stylesforiin10: # ':' (Colon)
...
endrepeat10do# 'do'
...
end
| 4 | Greater than | -
<= | 4 | Less than or equal to | -
= | 4 | Greater than or equal to | -
not | 3 | Logical negation | not 0 -> 1
and | 2 | Logical AND | 0 and 1 -> 0
or | 1 | Logical OR | 0 or 1 -> 1
Functions
Basic functions
Syntax
Description
str( number )
Convert a value to string.
num( string )
Convert a value to number.
abs( number )
Get a absolute value.
min( n1, n2[, ...] )
Get a minimum value in arguments.
max( n1, n2[, ...] )
Get a maximum value in arguments.
floor( number )
Largest integer less than or equal to the specified number.
ceil( number )
Smallest integer greater than or equal to the specified number.
truncate( number )
Get a integral part of a specified number.
round( number )
Rounds a specified number to the nearest even integer.
len( string ), strlen( string )
Return a length of string.
chr( number )
Code to character. e.g. chr( 97 ) -> 'a'
ord( string )
Character to code. e.g. ord( 'a' ) -> 97
slice( string[, start[, stop]])
Take a part of string. e.g. silce( "takoyakiki", 3, -2 ) -> 'oyaki'
random( )
Get a random real number as (0.0 <= N < 1.0).
randrange( min, max[, step] )
Get a random real number as (min <= N < max)
uniform( min, max )
Get a random real number as (min <= N <= max).
randint( min, max )
Get a random integer number as (min <= N <= max).
Control functions
Syntax
Description
print( text )
Output the specified string to console.
wait( duration )
Wait for a specified time. duration: wait time in milliseconds.
beep( )
Plays the sound of a beep.
beep( frequency )
Same as above.
beep( frequency, duration )
Same as above.
tap( x, y, duration )
Tap screen.
tap( tno, x, y, duration )
Tap the screen with the specified touch point number.
swipe( x, y, angle, distance, duration )
Swipe screen.
swipe( tno, x, y, angle, distance, duration )
Swipe screen with the specified touch point number.
touch_on( tno, x, y )
Make touch point on the screen.
touch_move( tno, x, y, duration )
Move coordinate of touch point.
touch_off( tno )
Remove specified touch point.
adb( command )
Execute the adb command synchronously and return standard output/error as string.
save_capture( )
Save the screen capture to file.
rotate( angle )
Rotates the screen by the specified angle based on the current angle. (Relative rotation)
rotate_to( angle )
Rotates the screen to the specified angle. (Absolute rotation)
Function parameters
wait
Name
Data type
Description
Range
duration
Number
Wait time in milliseconds.
10 - 60000
beep
Name
Data type
Description
Range
frequency
Number
Sound frequency in Hz. (Default value is 1000)
100 - 20000
duration
Number
Play time in milliseconds. (Default value is 100)
10 - 60000
tap
Name
Data type
Description
Range
tno
Number
Number to distinguish the touch points.
0 - 9
x, y
Number
Normalized coordinate of screen. 0 is left/top, 1.0 is right/bottom.
-
swipe
Name
Data type
Description
Range
tno
Number
Number to distinguish the touch points.
0 - 9
x, y
Number
Normalized coordinate of screen. 0 is left/top, 1 is right/bottom.
-
angle
Number
Angle in degrees of Swipe direction. 0 is rightward, 90 is upword.
-360 - 360
distance
Number
Swipe distance represented by ratio of short side of screen.
duration
Number
Swipe time in milliseconds.
10 - 60000
touch_on
Name
Data type
Description
Range
tno
Number
Number to distinguish the touch points.
0 - 9
x, y
Number
Normalized coordinate of screen. 0 is left/top, 1 is right/bottom.
-
touch_move
Name
Data type
Description
Range
tno
Number
Target touch point number.
0 - 9
x, y
Number
Normalized coordinate of screen. 0 is left/top, 1 is right/bottom.
-
duration
Number
Moving time in milliseconds.
10 - 60000
touch_off
Name
Data type
Description
Range
tno
Number
Target touch point number.
0 - 9
adb
Name
Data type
Description
Range
command
String
Argument for adb command. e.g. shell cd /sdcard
-
rotate
Name
Data type
Description
Range
angle
Number
Angle in degrees of screen based on current orientation.