I downloaded a script (from Macro Scheduler website) called Mouse Tester, but it is not working. I think the part that is broken is when it is trying to tell which mouse button (Left, Right, Middle) is doing the click. I think I'm following the code. It is using two events:
AddDialogHandler>Dialog1,MSButton1,OnMouseDown,MDOWN
AddDialogHandler>Dialog1,MSButton1,OnMouseUp,MUP
From there is goes to the two subroutines (MDOWN or MUP)
SRT>DBUTCHECK
Let>mdbutton=%MDOWN_BUTTON%
SetDialogProperty>Dialog1,Edit1,Text,x=%mx% y=%my% button val: %mdbutton%
IF>mdbutton=0
LET>dbutt=Left
ENDIF
IF>mdbutton=8386
LET>dbutt=Right
ENDIF
IF>mdbutton=32
LET>dbutt=Middle
ENDIF
END>DBUTCHECK
But the variable %NDOWN_BUTTON% has nothing stored in it. The script may be from an old version of Macro Scheduler, I'm not sure. So how can I tell which mouse button has been used to click on something?
Thank You
I'm a beginner
How to tell which mouse button is used
Moderators: Dorian (MJT support), JRL
How to tell which mouse button is used
MS v15 | Windows 11 Pro | NY, USA
Re: How to tell which mouse button is used
I found the original post here: viewtopic.php?p=29092
MS v15 | Windows 11 Pro | NY, USA
- Dorian (MJT support)
- Automation Wizard
- Posts: 1384
- Joined: Sun Nov 03, 2002 3:19 am
- Contact:
Re: How to tell which mouse button is used
If you temporarily add a MessageModal you can see what the corresponding values are when you click :
For me, a right-click was 1. So I changed 8386 to 1 :
Left click was blank :
Make sure to change for both down and up.
..and I don't have a middle button to test with.
Code: Select all
Let>mdbutton=%MDOWN_BUTTON%
MessageModal>mdbutton
Code: Select all
IF>mdbutton=1
LET>dbutt=Right
ENDIF
Code: Select all
IF>mdbutton=
LET>dbutt=Left
ENDIF
..and I don't have a middle button to test with.
Yes, we have a Custom Scripting Service. Message me or go here
- Dorian (MJT support)
- Automation Wizard
- Posts: 1384
- Joined: Sun Nov 03, 2002 3:19 am
- Contact:
Re: How to tell which mouse button is used
Of course it's worth pointing out you can do this with an OnEvent. Be careful to include an exit routine (As I have here) otherwise you'll just trigger the SRT every time you try to press Stop.
Code: Select all
onevent>KEY_DOWN,VK1,0,LMB
onevent>KEY_DOWN,VK2,0,RMB
//Pseudo Script (20 second loop)
let>pointlessloop=0
repeat>pointlessloop
Let>pointlessloop=pointlessloop+1
Wait>1
Until>pointlessloop,20
srt>LMB
mdl>left mouse
ask>Exit?,AskExit
If>AskExit=YES
exit
Endif
END>LMB
srt>RMB
mdl>right mouse
ask>Exit?,AskExit
If>AskExit=YES
exit
Endif
END>RMB
Yes, we have a Custom Scripting Service. Message me or go here
Re: How to tell which mouse button is used
Thank you for your help. I will study both.
MS v15 | Windows 11 Pro | NY, USA