Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Capture screen coordinates of user mouse click
#1
I have a macro that requires clicking in the right spot b/c there are no kb shortcuts (tabbing, etc).

But the size of the window and the column widths within it can change the position of a check box to just about anywhere.

How could I have a macro go:

int intX
int intY
Msg box "Dear user, please click check box"
capture coordinates to intX, intY
use intX, intY to check off box later in macro
#2
try using "accessible objects actions" or "control specific actions".
usually you can click and drag the target reticle over the checkbox and have it set the state.
An old blog on QM coding and automation.

The Macro Hook
#3
Or, it is is not possible, for example in java programs, try Find Image.

To capture mouse coordinates can be used xm or GetCursorPos:
Code:
Copy      Help
OnScreenDisplay "Dear user, please click check box" 3
wait 0 ML
POINT p
xm p ;;capture coordinates to p
;...

lef p.x p.y ;;use p to check off box later in macro
#4
Thanks Ken

I went with your code there Gintara, works great

2 questions

1-Can OnScreenDisplay message disappear upon clicking anywhere (on check box) instead of on the display text to get rid of it. I'd like to pace this (I have a few clicks to record) by when the user clicks, not by set time between click requests.

2-Where can I find help on POINT function?

Thanks Gintara!
#5
OnScreenDisplay can be "click hide" set the flag for it though.

Code:
Copy      Help
OnScreenDisplay("Click Here"  2 1 10 "" 18 0x2a2a2a 4)

look in help for "xm" topic in the help for POINT.
An old blog on QM coding and automation.

The Macro Hook
#6
Code:
Copy      Help
OnScreenDisplay "Dear user, please click check box" 30
wait 0 ML
clo win("" "QM_OSD_Class"); err
...

POINT is a variable type. It consists of two int variables - x and y. Function xm populates a variable of POINT type with mouse coordinates.
#7
Thanks.

I used your code and had played with flags before.

You have to click the message to get rid of it.

Can the user click the checkbox and have the message disappear at that point?


Forum Jump:


Users browsing this thread: 1 Guest(s)