Using set of instructions with sleep function from middle mouse button

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Shekhar Singh
Posts: 115
Joined: 06 Dec 2022, 02:35

Using set of instructions with sleep function from middle mouse button

Post by Shekhar Singh » 06 Dec 2022, 10:15

Hi, how can I make my middle mouse button to
press g first , than wait for a second , press z than wait for 10 seconds and press g again

Code: Select all

MButton::Send,g
Sleep 1000
Send, z
Sleep 10000
Send, g
return
I tried this code , but didn't work . Can anyone correct this.


[Mod edit: Located the code tags around the code instead of after.]

User avatar
boiler
Posts: 16767
Joined: 21 Dec 2014, 02:44

Re: Using set of instructions with sleep function from middle mouse button

Post by boiler » 06 Dec 2022, 10:59

Move the Send,g to the line after the hotkey label. Putting it on the same line signifies a single-line hotkey, and the lines following it will not be executed. Explained here.

Rohwedder
Posts: 7551
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Using set of instructions with sleep function from middle mouse button

Post by Rohwedder » 06 Dec 2022, 12:08

Hallo,
with a #Warn you would have been alerted to this fact. Try:

Code: Select all

#Warn
MButton::Send,g
Sleep 1000
Send, z
Sleep 10000
Send, g
return


Post Reply

Return to “Ask for Help (v1)”