Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Right mouse down and release problem
#1
Greetings , im trying to create a macro that will override regular mouse button behavior.

Right click down will be eaten by QM and
mouse coordinates will be saved
mouse coordinates will be set to center of screen .
right mouse button down command will be sent


And when right click is released
it will be eaten aswell and
mouse coordinates will be set back to the saved position
right mouse button release command will be sent

However , when first macro eats and sends right mouse button down command.
Second macro doesnt receive the right mouse button release event.
And right mouse button state stays as "pressed"

How can i make this work ? Thank you in advance.
#2
I would use a filter function.

Function FFT_Mouse_ClickCenter
Trigger #SR //FFT_Mouse_ClickCenter     Help - how to add the trigger to the macro
Code:
Copy      Help
;/
function# iid FILTER&f

spe 10
POINT p; xm p
rig+ ScreenWidth/2 ScreenHeight/2
mou p.x p.y
rig-

ret -1

;ret iid    ;; run the macro.
;ret macro    ;; run other macro. Here 'macro' is its id or name.
;ret 0        ;; don't run any macros.
;ret -1        ;; don't run any macros but eat the key. Eg if the filter function started a macro using mac.
;ret -2        ;; don't run this macro. Other macros with the same trigger can run.

Here trigger is Shift+right click, eat, when released.
The function is called on button down. It right-drags from screen center to current position.
In function properties check that it is a filter function.
#3
I have been trying variations of that filter function all night long and it didnt perform as it should.
Tried to change my macro definition to a simple one ,
But filter function would work with half second delay and then fail.
After 3 fails, it would stop working anymore requiring me to restart QM.

What im trying to do right now is

Left mouse button click is overridden by:

"filter function"
Code:
Copy      Help
function# iid FILTER&f
lef+
ret iid

"macro which uses above filter function with mouse left button ,eat, when released"
Code:
Copy      Help
spe 25
OnScreenDisplay "left up" , 0.1 , 850 , 50
lef-

This is causing me a lot of headache.

Basically im trying to override mouse left and up clicks and do something fancy in between . Depending on software , these i will work later.
But i havent been able to take over mouse clicks seamlessly yet. Thank you in advance for your answers.
#4
If you use lef+ and lef-, maybe then don't need to eat?
Simplest macro, with right click trigger, without filter function, with 'eat' unchecked and 'when released' unchecked:
Macro Macro1996
Trigger #R 0x9     Help - how to add the trigger to the macro
Code:
Copy      Help
out 1
wait 0 MR
out 2

This code does not allow to do something between button down and up. Please give a code example what the macro would do. And is it necessary to eat user-generated mouse events?
#5
Apparently the issue was something else entirely , but still related to QM . That being said , its probably software's fault not QM.
Software which im trying to use QM on stops responding when i use *any* QM macro , until* i move mouse , then it comes back .
Weird .

But that same software didnt stop responding when i used autohotkey macro and everything was fine.

This is the macro i used on autohotkey.
Code:
Copy      Help
#SingleInstance, force
#IfWinActive ahk_class GxWindowClass

RButton::
BlockInput, MouseMove
MouseGetPos, curx, cury
MouseClick, right,,, 1, 0, D  ; Hold down the left mouse button.


;MouseMove, 897, 518 ,0
sleep, 5
Blockinput, MouseMoveOff


KeyWait, RButton  ; Wait for the key to be released.

BlockInput, MouseMove
MouseGetPos, newx, newy



sleep, 5

//MouseMove, curx, cury , 0


MouseClick, right,,, 1, 0, U  ; Release the mouse button.
Blockinput, MouseMoveOff


if(newx != curx && newy != cury)
{
;MouseMove, curx, cury , 0
}

return




LButton::
BlockInput, MouseMove
MouseGetPos, curx, cury
MouseClick, left,,, 1, 0, D  ; Hold down the left mouse button.


;MouseMove, 897, 518 ,0
sleep, 5
Blockinput, MouseMoveOff


KeyWait, LButton  ; Wait for the key to be released.

BlockInput, MouseMove
MouseGetPos, newx, newy



sleep, 5

;MouseMove, curx, cury , 0


MouseClick, left,,, 1, 0, U  ; Release the mouse button.
Blockinput, MouseMoveOff


if(newx != curx && newy != cury)
{
;MouseMove, curx, cury , 0
}

return

Its not perfect but still needs some polishing .


Forum Jump:


Users browsing this thread: 1 Guest(s)