FRep support archive

Category : Variables (1)

Log / Reference of Variable

Categories: Variables
Tags: No Tags

View Last Log / Variable / If / Switch

The log for the edited sequence can be referred by menu View Last Log in Edit Sequence, which is available with FRep Unlock Key.  To get the details, you can add Variables control, or Set variables on success/fail for important phase.  The used variables can be referred in the log, too.

View Last Log in Edit Sequence (Requires Unlock Key)

FRep View Last LogShow success/fail, finished time, and last played item for last playing.  Variables referred in the sequence are also shown.  With Log Only Last Error option, successful playing does not overwrite the log.

– Date
The date of playing finished with rectangle of result color, green for success, red for fail or interrupted.

– Label, Result: Last played item
Label name on playing, result of success or fail/interruption, and #. label of item of last played.

– Error message
Information message about the issue for the failure or abort.

– Referred variables
The variables referred in the sequence with their values at finish playing.

FRep VariablesVariables

Retrieve and/or calculate values in playing sequence to store them to variables.  The variables can be used in specific control settings or IF / Switch branch (see next section).  The stored values are common in all sequences, i.e. all variables can be referred / overwritten by other sequences.

Registered statements in the list will perform from above.

Remove / prepend statements from left trash / right + buttons, edit by tapping the statement.  Long-tap the statement will start dragging to reorder in the list.

Format of statements;

(Destination Variable)=(Code):(Arg1)(Operator)(Arg2)

Variable name: [A-Za-z_@][0-9A-Za-z_]+

Definable variable name consists of alphanumerical characters and under bar(_).  First letter cannot be a number.  The reserved variables as environmental variables start with @, and they are used only for arguments and some settings.

frep0, frep1, frep2, frep3, frep4 are passed to Tasker as temporal variables %frep0, %frep1, %frep2, %frep3, %frep4 by Tasker Event Plugin (%frepsuccess will be 1 for success or 0 for fail to play).

Value Type [(Empty), Number, Rectangle, String]

There are 4 value types including empty value.  The type of variables are determined by the value they have.

Type Description Example
(Empty) The state of no value defined.
*Shown as null in Log.
var=num:
var=rect:
var=str:
Number Integer or decimal, including negative value. var=num:0
var=num:0.012
var=num:-0.5
Rectangle Rectangle defined by: (left top right bottom)
Each component must be integer or variable.
var=rect:(10 20 30 40)
String String defined by: “character sequence”
Escaped characters; (line feed)\n (tab)\t (\backslash)\\ (“quote)\”
var=str:”line1\nline2″

@reserved environmental variables

System variables for referring the state of device or playing sequence.

Name Type Description
@repeat Number Current repeat number (0 for first time)
@loop Number Last loop count number (0 for first time)
@lastif Number Last IF result (success/true:1, fail/false:0)
@rotation Number Current orientation of the device
(0: 0°, 1:90°, 2:180°, 3:270°)
@cpuusage Number Current CPU load (0~100) *Works on Android ~7
@start Number Starting time (ms)
@now Number Current time (ms)
@lastfinish
Number Success of failure of last replay
(0:not replayed, -1:failed/interrupted, 1:successful)
@laststep
Number Step No. in Edit Sequence on last replay finish
(0 if it is not replayed)
@lastmatch Rectangle Latest successful Image Match position
@screen Rectangle Screen size of the device (fixed for orientation 0°)
@clipboard String Contents of the clipboard text *Works on Android ~9
@tofrep
String Text passed by the caller, by FRep Tasker Plugin
(Empty when started manually or with shortcut)

Special modification for variables; var.left, var.x, var.length

For some types of variables, the derived values can be referred by special postfix modification.

Modification Description Example
(Rect).left
(Rect).top
(Rect).right
(Rect).bottom
Refer each component of the rectangle l=num:r.left
(Rect).x
(Rect).y
Refer the center x or y of the rectangle
x=(left+right)/2
y=(top+bottom)/2
centerx=num:r.x
(Rect).width
(Rect).height
Refer the width or height of the rectangle
width=right-left
height=bottom-top
w=num:r.width
(String).length Refer the length of the string len=num:s.length
(String).asnum
(String)
.asrect
Refer the number converted from numeric string
Refer the rectangle converted from “(left top right bottom)” type string
n=num:s.asnum
r=rect:s.asrect
(String).asint
(Num)
.asint
Refer the integer number (truncated after the decimal point) i=num:s.asint
i
=num:n.asint
(Num).asstr
(Rect)
.asstr
Refer the number / rectangle as string s=str:n.asstr
s=str:r.asstr
(Num).asdate
(Num)
.astime
Refer the time (ms) number as date string with format “yyyy/MM/dd kk:mm:ss”
Refer the time (ms) number as time difference string with format “hour:min:sec.ms”
s=str:@now.asdate
t=num:@now@start
s
=str:t.astime

Code references

num: Set / Calculate Number

Operator Arg1 Arg2 Description Example
(None) Variable, Number, (Empty) (None) Set number value var=num:0
+ – * Variable, Number Variable, Number Add Subtract Multiply var=num:var + 1
/ Variable, Number Variable, Number Divide
(If Arg2 is 0, returns Arg1 without change)
var=num:var / 3
% Variable, Number Variable, Number Residue
(If Arg2 is 0, returns 0)
var=num:var % 3
& | ^ Variable, Number Variable, Number Bit operation AND OR XOR
(Args are forced to be integer)
var=num:var & 7
~ Variable, Number Variable, Number Bit operation ANDNOT
(Args are forced to be integer)
var=num:var ~ 128

rect: Set / Calculate Rectangle

Operator Arg1 Arg2 Description Example
(None) Variable, Rectangle, (Empty) (Empty) Set rectangle value var=rect:(0 0 100 200)
+ – * Variable, Rectangle Variable, Number, Rectangle Add Subtract Multiply
*If Arg2 is rectangle, each component will be used for calculation.  If Arg2 is number, it is applied for all components.
var=rect:var + (10 20 10 20)
*Move the var rectangle by (10,20)
/ Variable, Rectangle Variable, Number, Rectangle Divide
*If Arg2 is rectangle, each component will be used for calculation.  If Arg2 is number, it is applied for all components.  When the component is divided by 0, it will not change.
var=rect:var / (2 2 0 0)
*Halve the (left,  top) coordinates
& Variable, Rectangle Variable, Rectangle Intersect
Retrieve common area in both rectangles.
var=rect:var & @screen
*Clip by screen size
| Variable, Rectangle Variable, Rectangle Union
Retrieve the minimum area which covers both rectangles.
var=rect:var | @lastmatch
*Expand rectangle to contain image matched area

str: Set / Calculate String

Operator Arg1 Arg2 Description Example
(None) Variable, Number, Rectangle,
String, (Empty)
(None) Set String value var=str:”char seq”
+ Variable, Number, Rectangle,
String
Variable, Number, Rectangle,
String
Concatenate 2 values as string var=str:var + “\n”
*Append line feed
sub Variable, String Rectangle Extract string from Arg1, as defined range of Arg2 (la ln ca cn).When ln>0, extract ln lines from offset:la.When cn>0, extract cn characters from offset:ca.*If la<0 or ca<0, each extraction starts from back position from tail. var=str:var sub (1 2 5 10)
*Extract 2 lines from var, offset:1 (#2,3 line) and then get 10 characters from 6th.var=str:var sub (a 1 0 0)
*Extract line #(a+1) from var.var=str:var sub (0 0 -5 5)
*Extract last 5 characters from var.
idx Variable, String Variable, String If Arg1 contains Arg2 string, the position of Arg2 start in Arg1 string (first is 0).
If Arg1 does not contain Arg2 string, -1.
var=str:”abcde” idx “cd”
*var is 2.var=str:”abcde” idx “f”
*var is -1.
read Variable, String (None) Read the file designated by the path of Arg1. (up to 1MB) var=str:”/sdcard/test.txt” read

Other Functional Codes

Code Arg1 Arg2 Description Example
toast: Variable, Number, Rectangle,
String
(None) Show the message by popup. toast:”message”
clean: (None) (None) Clear all variables except environmental ones(@~). clean:

IFFRep IF

Branch or finish the sequence by condition of variables.  If they meets the conditions, the sequence proceeds to On Success, and @lastif will be 1.  If not, the sequence proceeds to On Fail, and @lastif will be 0.

Registered statements in the list will perform from above.

Remove / prepend statements from left trash / right + buttons, edit by tapping the statement.  Long-tap the statement will start dragging to reorder in the list.

Format of statements;

and/or(not):(Arg1) (Operator) (Arg2)

Combined condition by and: or: (andnot: ornot:)

Multiple conditions can be combined with and: / or: cases.  With and:, previous condition must be met to succeed.  With or:, new condition check starts even if the above conditions fail.  The first condition ignores and: / or: cases because they make sense only with previous condition(s). Neither of and: or: cannot be nested.  If there are multiple conditions divided by or:, each section is colored in the list.

andnot: ornot: are variant of and: or:, they use the reversed result of each condition check.

Operators for condition

Operator Arg1,2 Description Example
==
!=
Variable, Number, Rectangle,
String, (Empty)
Check if the contents of Args are equal or not equal. and:var == “char seq”and:@loop == 0
*Check if first loop or not
> >=
< <=
Variable, Number Compare the number of Args. and:var > 0
& Variable, Number, Rectangle If Args are numbers, success on the result of BITAND operation is not zero.If Args are rectangle, success on any intersect area exists. and:var & 5and:r & @lastmatch
*Check if the result of Image Match hits on r or not
]= Variable, Rectangle, String If Args are rectangle, success when Arg1 equals or includes whole Arg2 area.If Args are string, success when Arg1 contains Arg2 string. and:r ]= @lastmatch
*Check if the result of Image Match is in r or notand:var ]= “ok”
*Check if var has string “ok” or not

SwitchFRep Switch

Branch the sequence by condition of variables.  Each condition has respective destination.  The conditions are evaluated from the top of the list, and the sequence proceeds to the destination of first met condition.  When all conditions do not match, it goes to Other(default): destination.

Remove / prepend statements from left trash / right + buttons, edit by tapping the statement and the destination.  Long-tap the statement will start dragging to reorder in the list.

The available operators are same with IF statements, except for combination (and: or: etc).

TIPS

– To confirm the contents of the variables on successful replay, set Log Only Last Error option to OFF and then play the sequence.

– To set the clipboard text as variable, add Clipboard control and assign the variable from ▼ button in its settings.

page 1 of 1


Amazon
USB OTG adapter

USB OTG cable

USB OTG (host) adapter to connect between 2 Android devices, for FRep setup tool for Android


Bluetooth Keyboard

Bluetooth keyboard for KeyTrigger


Tabletop smartphone stand

Tablet stand
AdSense