Send a key after LButton is pressed

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
Audacity00
Posts: 1
Joined: 25 Mar 2023, 15:00

Send a key after LButton is pressed

Post by Audacity00 » 25 Mar 2023, 15:03

Hello
I want to send the key "Z" 0.5 secconds after the LButton is pressed once
I tried this code:

Code: Select all

LButton::Z
However, it doesn't work, as if the LButton is not even pressed, or ignored
I'm new with using AHK
Thankyou!

User avatar
mikeyww
Posts: 26883
Joined: 09 Sep 2014, 18:38

Re: Send a key after LButton is pressed

Post by mikeyww » 26 Mar 2023, 04:46

Hello,

Welcome to AutoHotkey and this forum.

I would start with basics. The documentation is a great source of information. If you read the following page, you will learn a lot.

https://www.autohotkey.com/docs/v2/Hotkeys.htm

Your current script has a few problems. It remaps a key, which is not what you want. It means that LButton acts like Z. You want something completely different: you want LButton to click the button like it usually does-- not like a remap-- and then wait, and then send another key.

Code: Select all

#Requires AutoHotkey v2.0
~LButton::Sleep(500), Send('z')
The tilde allows the hotkey itself to be sent first. The Send function then sends another key. The page that I have cited refers to these and provides you with additional examples.

Post Reply

Return to “Ask for Help (v2)”