Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Macro trigger on mouse button press
#1
It’s easy enough to trigger a macro by pressing a mouse button and then lifting it. But can a macro be triggered immediately once the button is pressed?

Yes, this is a pretty fiddly difference. But I’ve gotten myself into trouble quite a few times with a macro which triggers when a button is lifted — Intuitively, I’m somehow expecting it to run when the button is pressed, instead.
9: ) Lindsey Dubb
#2
Assign a filter function that launches the macro using mac. Filter functions run on button down, because they must have a chance to eat the mouse message.

Every mouse-button macro that has this filter function runs on button down:

Code:
Copy      Help
;/
function# iid FILTER&f

mac iid ;;run the macro now, not when button is released
ret -1 ;;eat the mouse message if Eat is checked
#3
Thanks — That works great! I wasn’t sure whether this was a Wish List or a programming question. Looks like it is, indeed, doable.

For anyone curious — I’ve got my mousewheel “button” mapped to perform a double click (except in Firefox). When the double click triggered on mouse button up, that would sometimes cause an unexpected drag rather than a double click if I had accidentally moved the mouse between pressing and releasing the button.
9: ) Lindsey Dubb
#4
I’ve noticed a small oddity with this — It results in the (desired) double click, but there’s apparently also a middle-click event. I’m not sure if the middle click isn’t being “eaten” by my macro, or if it’s the middle-button-up event which is being detected.

This is more of a quirk than a problem — most programs ignore middle clicks, anyhow. The one spot where it shows up is with Quick Macro’s own taskbar menu, where a middle click temporarily disables any macro triggers.

In case it’s relevant, the macro’s text is:
Code:
Copy      Help
dou
(yep, pretty simple)
and the trigger is the middle mouse button, with Gintaras’ suggested filter function. The “eat” checkbox for the macro is activated.
9: ) Lindsey Dubb
#5
Yes, WM_MBUTTONUP is posted. The double click is intercepted by the mouse hook and resets filtering of middle mouse button up message.
#6
double left sysmenu doesn't work for me, because it
gets eaten by left sysmenu.

how can i perform multi clicks like tripple left sysmenu ?
pi


Forum Jump:


Users browsing this thread: 7 Guest(s)