<< Click to Display Table of Contents >> Navigation: 3. Script Language > Window Operations > Window Operations |
MiniRobotLanguage (MRL)
GAR. Command
Get actual RECT
Intention
The GAR-Command can be used to get the actual localized rectangle of any window or object in screen coordinates. It may also return the type of localized object and the actual localized window-handle.
All windows or accessible objects or graphical objects that are localized have a rectangle outline. This command will return their rectangle coordinates, in this format:
left,top,right,bottom
as screen coordinates.
The simplest mode of using GAR. is just writing
GAR.
then it may leave coordinates like these on the Stack:
Here is a example that uses P1 instead of the stack for the return-RECT coordinates:
STW.ct|MyClassName|Sample Application
SCW.nct|1|Edit|{&NOTEXT:}
GAR.$$REC
DBP.$$REC
ENR.
' Result is: 2653,278,2755,298
You can also find out, if the last localized Object was a window or something else:
STW.ct|MyClassName|Sample Application
SCW.nct|1|Edit|{&NOTEXT:}
SAO.r|42
GAR.$$REC|$$TYP
DBP.$$TYP
ENR.
' Result is "1" - accessible Object
STW.ct|MyClassName|Sample Application
SCW.nct|1|Edit|{&NOTEXT:}
SAO.r|42
GAR.$$REC|$$TYP
DBP.$$TYP
ENR.
' Result is "0" - window type object
In the following example we will use the command to retrieve the actual located window handle - if any.
STW.ct|MyClassName|Sample Application
SCW.nct|1|Edit|{&NOTEXT:}
GAR.$$REC|$$TYP|$$HWN
DBP.$$REC-$$TYP-$$HWN
SAO.r|42
GAR.$$REC|$$TYP|$$HWN
DBP.$$REC-$$TYP-$$HWN
ENR.
Result is:
[09:41:05] [16] 2653,278,2755,298-0-265108
[09:41:06] [20] 2655,280,2753,296-1-0
Syntax
GAR.[P1][|P2][|P3]
Parameter Explanation
P1 - (optional) Variable that will get the Rectangle coordinates, if omitted, Stack is used.
P2 - (optional) Variable that will receive the type of the last localized Object.
These types are:
0 - Window-Object
1 - accessible (web/office) Object
2 - graphical object
P3 - (optional) Variable that receives the handle of the actual localized window, if any.
If the last localized object is not of type "window", this variable will be set to zero.
Example
STW.ct|MyClassName|Sample Application
SCW.nct|1|Edit|{&NOTEXT:}
GAR.$$REC|$$TYP|$$HWN
DBP.$$REC-$$TYP-$$HWN
SAO.r|42
GAR.$$REC|$$TYP|$$HWN
DBP.$$REC-$$TYP-$$HWN
ENR.
Remarks
-
Limitations:
-
See also:
• 1.8. Selecting the Application (Topwindow)
• CST. - Coordinate System Transform
• GRM. - Get Rect Middle-Point