Jump to content
Sign in to follow this  
Christopher Blue

Sending modified mouse clicks.

Recommended Posts

Christopher Blue

I am trying to send a mouse click with a modifier key (ctrl, alt, shift, etc.) held down but using Send("{modkey down}") doesn't seem to be working.

Share this post


Link to post
Share on other sites
gamepin126

;~ VK_BACK (08)
;~     BACKSPACE key

;~ VK_TAB (09)
;~     TAB key

;~ VK_CLEAR (0C)
;~     CLEAR key

;~ VK_RETURN (0D)
;~     ENTER key

;~ VK_SHIFT (10)
;~     SHIFT key

;~ VK_CONTROL (11)
;~     CTRL key

;~ VK_MENU (12)
;~     ALT key

;~ VK_PAUSE (13)
;~     PAUSE key

;~ VK_CAPITAL (14)
;~     CAPS LOCK key

#include <Misc.au3>

While 1
    If _IsPressed("11") Then Clickity() ; Ctrl is pressed
    If _IsPressed("1B") Then Quit()
WEnd

Func Clickity()
    MouseClick("left")
EndFunc

Func Quit()
    Exit
EndFunc

Edited by gamepin126

Share this post


Link to post
Share on other sites
Christopher Blue

So I should use Send("{ctrl down}") then use that code to wait for it to take effect?

Share this post


Link to post
Share on other sites
gamepin126

If you hold it down it'll be pressed repeatedly, or do you want it to be able to click and hold click?

Share this post


Link to post
Share on other sites
Christopher Blue

Basically I want to ctrl-left click the screen. Like if I held down ctrl and clicked the left mouse button.

Share this post


Link to post
Share on other sites
Emperor

I'm guessing this should work

Send("{CTRLDOWN}")
MouseClick("left", 0, 0)
Send("{CTRLUP}")

Share this post


Link to post
Share on other sites
Christopher Blue

Hm, I have been trying Send("{CTRL down}") and Send("{CTRL up}"). I will try what you put, emperor.

Edited by Christopher Blue

Share this post


Link to post
Share on other sites
Emperor

Strange it works for me when I use {CTRLDOWN} and {CTRLUP} but not when I use {CTRL DOWN} and {CTRL UP}.

Edited by Emperor

Share this post


Link to post
Share on other sites
Christopher Blue

Aye, me too. But CTRLDOWN and CTRLUP work! Thanks, Emperor.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.