Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get XY of mouse click help
#1
Hello QM Forum,

I was wondering if its possible to use QM to get the XY cords when my mouse clicks and out them? So I could turn them into code like: lef 302 401 "I.E"?
Please dont mistake this as a key logger I dont want anything like that, just as a preference setting for windows that cannot be clicked with other calls besides mouse clicks. So it can be universal instead of only working on my computer. Thanks for your time its much appreciated.
#2
-
#3
Thank you, sorry about not checking to see if posts existed before asking. Wasnt really to sure what to search for though.
#4
ok I found this code you had, I tried messing with it a bit but cant get the result I desire. I only want it to out the x y if i lef click. but this code outs and then ends every time i just move my mouse and Im not really sure how to edit it to work how I need it to. Will you make me an example please?

Macro Macro1276
Code:
Copy      Help
KBDLLHOOKSTRUCT ks
MSLLHOOKSTRUCT ms
int k=WaitForKeyOrMouse(0 ks ms)
;out k
str what action
if(k<256) ;;key
,qm.FormatKeyString k 0 &what
,action=iif(ks.flags&LLKHF_UP "released" "pressed")
,
,out "key %s %s" what action
else ;;mouse
,sel k
,,case [WM_LBUTTONDOWN,WM_LBUTTONUP] what="left"
,,case [WM_RBUTTONDOWN,WM_RBUTTONUP] what="right"
,,case [WM_MBUTTONDOWN,WM_MBUTTONUP] what="middle"
,,case [WM_XBUTTONDOWN,WM_XBUTTONUP] sel(ms.mouseData>>16) case XBUTTON1 what="X1"; case XBUTTON2 what="X2"
,,case WM_MOUSEMOVE what="move"
,,case WM_MOUSEWHEEL what="wheel"; action=iif(ms.mouseData>>16&0x8000 "backward" "forward")
,sel k
,,case [WM_LBUTTONDOWN,WM_RBUTTONDOWN,WM_MBUTTONDOWN,WM_XBUTTONDOWN] action="pressed"
,,case [WM_LBUTTONUP,WM_RBUTTONUP,WM_MBUTTONUP,WM_XBUTTONUP] action="released"
,
,out "mouse %s %s at %i %i" what action ms.pt.x ms.pt.y
#5
also look in AltMouseTriggers
#6
Do I look it up in MSDN Library or does QM have reference about it?
#7
It is in the search results. Click the link again and you will find it.
#8
Ok great, I figured out what I need to do.

Is is possible to make an if statement so i can end the constant running thread if the window is single lef clicked?

what I want to do is have it check like this.

if(lef mouse click occurs) end

using this code case [WM_LBUTTONDOWN,WM_LBUTTONUP]to check if the mouse has been clicked.
#9
,case WM_LBUTTONDOWN
,end
#10
Ok ive gotten the code to this much it works how I want except its still ending without me clicking? What am I missing? I have all the member functions in file just didnt think need to post let me know and I will post them as well.

Macro Macro
Code:
Copy      Help
KBDLLHOOKSTRUCT ks
MSLLHOOKSTRUCT ms
int k=WaitForKeyOrMouse(0 ks ms)

sel k
,case WM_LBUTTONDOWN
,out "%i %i" ms.pt.x ms.pt.y
,end
#11
Gintaras Wrote:,case WM_LBUTTONDOWN
,end

It is in AltMouseTriggers.

I don't recommend to use WaitForKeyOrMouse. Would need to goto beginning on case else, but it is much overhead.

----------------

If need only single click:
Macro Macro1423
Code:
Copy      Help
wait 0 ML
#12
Ok I looked for AltMouseTriggers and this is what I found:
AltMouseTrigger help

I got the code off the page that was there but wasnt really sure how to use it, this is my first time going indepth with mouse click actions, would you mind making me a small example of how to use AltMouseTriggers?
#13
Need hooks only if you need all clicks.
If need 1 click, use this:

Macro Macro1423
Code:
Copy      Help
wait 0 ML
#14
Ok thats good I only need the 1 mouse click to get the x y, but how can i get xy without:

Function Function
Code:
Copy      Help
out "%i %i" ms.pt.x ms.pt.y
Because when I run the code with wait 0 ML it outs 0 0 like the x y's are not registering?
#15
Macro Macro1423
Code:
Copy      Help
wait 0 ML
out "%i %i" xm ym
#16
Thank you I appreciate the help very much. Sorry for taking so long to figure out exactly what i needed.


Forum Jump:


Users browsing this thread: 1 Guest(s)