[Solved]Which is the correct Left Mouse Virtual key Code?

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
ocnuybear
Pro Scripter
Posts: 95
Joined: Sun Jul 15, 2018 5:14 pm

[Solved]Which is the correct Left Mouse Virtual key Code?

Post by ocnuybear » Fri Mar 25, 2022 9:57 am

Reffering to :https://help.mjtnet.com/article/262-virtual-key-codes

VK_LBUTTON=Left mouse button and not VK01, BUT in the script below only VK01 works, why?

Code: Select all

OnEvent>Key_Down,VK01,0,srtClick
//OnEvent>Key_Down,VK_LBUTTON,0,srtClick
Let>Keystate=0
Label>Loop
Wait>0.04
If>keystate<>0
Let>Keystate=0
Message>Great answer
Wait>0.35
PushButton>Macro Scheduler Message,&OK
Wait>.6
Goto>Postloop
endif
Goto>Loop
Label>Postloop

SRT>srtClick
  Let>keystate=1
END>srtClick
EDIT:
Figured out the problem was that it needs the VK with the corresponding key number:
So it seems like you have to have VK and 2 digits:

VK_LBUTTON (1): Left mouse button
VK_RBUTTON (2): Right mouse button
VK_CANCEL (3): Control-break processing
VK_MBUTTON (4): Middle mouse button (three-button mouse)

Left mouse button = VK01
Right mouse button = VK02
Control-break processing = VK03
Middle mouse button (three-button mouse) = VK04

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts