Mathematical and algorithmic operations

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Mathematical and algorithmic operations >

Mathematical and algorithmic operations

CST. - Coordinate System Transform

Previous Top Next


MiniRobotLanguage (MRL)

 

CST. Command

Coordinate System Transform

 

 

Intention

 

The CST-Command can transform Coordinates between different coordinate systems.

 

Currently we can use three coordinate systems:

 

1. Screen Coordinates

2. Window Coordinates (these include the Non-Client Area)

3. Client Area Coordinates

 

For more details on these coordinate systems see here: 3.6 Using Quadrant-Coordinates

 

Using CST. you can transfer Point Coordinates like:

 

120,100

 

as well as Rectangle-Coordinates, like

 

120,100,200,400

 

from any of the three above coordinate systems to any of the three coordinate systems.

Here are some examples:

 

' Use Coordinates from Stack, Store Result on Stack

' Window handle is in $$MYW

' Transform Client -> Window Coordinates

CST.cw||$$MYW

 

' Use actual window as reference

' Transform Screen -> Client Coordinates

CST.s to c|$$REC

 

' Use Coordinates from Stack, Store Result on Stack

' Transform Window -> Screen Coordinates

CST.w_to_s

 

And some more examples:

 

CST.sc|$$REC|$$MYW

 

CST.cw|$$REC|$$MYW

 

CST.s to c|$$REC|$$MYW

 

CST.c_to_w|$$REC|$$MYW

 

CST.sc|$$REC|$$MYW

 

 

 

Syntax

 

 

CST.P1[|P2][|P3]

 

 

Parameter Explanation

 

P1  - Prototype that describes which transformation to do: The following are  available:

 

    "s to w","sw","s_to_w" - Screen Coordinates to Window coordinates

    "s to c","sc","s_to_c" - Screen Coordinates to Client coordinates

    "c to s","cs","c_to_s" - Client Coordinates to Screen coordinates

    "c to w","cw","c_to_w" - Client Coordinates to window coordinates

    "w to c","wc","w_to_c" - Window Coordinates to Client coordinates

    "w to s","ws","w_to_s" - Window Coordinates to Screen coordinates

 

Any of the three possible prototypes for each transformation is valid, you can choose how much you want to type.

 

 

P2  - (optional) Variable that contains whether Point- or Rectangle Coordinates.

      They have to be  in one of these formats:.

       a) x1,y1

       b) x1,y1,x2,y2

      If you omit P2, the command will try to get the coordinates from the TOS.

     

P3 - (optional) Variable that contains the handle of the window, that should be used for

      the transformation. If you omit P3 then the actual window-handle will be taken.

      If there is no valid actual window, the desktop-window (Screen coordinates) will

      be used.

 

 

 

Example

 

' Use the Testapplication

' for this Sample Script

STW.ct|MyClassName|Sample Application

HTV.$$MYW

SCW.nct|1|Edit|{&NOTEXT:}

MMV.

GAR.$$REC

DBP.$$REC

' Convert Screen->Client

CST.sc|$$REC|$$MYW

' Client->Window

CST.cw|$$REC|$$MYW

DBP.$$REC

' Window->Client

CST.wc|$$REC|$$MYW

' Client -> Screen

CST.cs|$$REC|$$MYW

DBP.$$REC

ENR.

 

 

 

 

Remarks

 

-

 

 

Limitations:

 

-

 

 

 

See also:

 

    3.6 Using Quadrant-Coordinates

    1.8. Selecting the Application (Topwindow)

    1.9. Locating Child-Windows

    ! SCW - Search-Child-Window

    !. STW. - Description

    GAR. - Get actual Rectangle

    GRM. - Get Rect Middle-Point

    MAP. - Move Active Point