Perform action before original hotkey function

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
ndiaz
Posts: 73
Joined: 10 Jan 2017, 17:05
Contact:

Perform action before original hotkey function

22 Mar 2019, 12:04

How can I perform an action before the original intended hotkey function?

Specifically, what I'd like to do is send some placeholder text to a text field before launching a Find & Replace operation.

Ctrl+H is used to launch the Find & Replace dialog, so when I press Ctrl+H, before the dialog opens, I'd like "MARKERHERE" to be sent to the text field where my cursor is.

I tried to pass through the hotkey, but the placeholder text is sent to the Find & Replace dialog instead of to the original text field. I also tried adding a sleep but that didn't help either.

Thank you in advance for your help!
Kobaltauge
Posts: 264
Joined: 09 Mar 2019, 01:52
Location: Germany
Contact:

Re: Perform action before original hotkey function

22 Mar 2019, 12:10

Could you split it up. When pressing CTRL+h do the first action. When release CTRL+h do the second action?
ndiaz
Posts: 73
Joined: 10 Jan 2017, 17:05
Contact:

Re: Perform action before original hotkey function

22 Mar 2019, 12:40

That sounds like a good idea, but I don't know how to implement it. I tried this, but got an invalid hotkey error message:

^h Down::
Send MARKERHERE{SPACEBAR}
Return

^h Up::
Send ^h
Return
A_AhkUser
Posts: 1147
Joined: 06 Mar 2017, 16:18
Location: France
Contact:

Re: Perform action before original hotkey function

22 Mar 2019, 14:05

Code: Select all

$^h::
	sendinput MARKERHERE{Space}
	KeyWait, h
	send ^h
return
my scripts
Osprey
Posts: 453
Joined: 18 Nov 2017, 05:50

Re: Perform action before original hotkey function

22 Mar 2019, 14:21

ndiaz wrote:
22 Mar 2019, 12:40
That sounds like a good idea, but I don't know how to implement it. I tried this, but got an invalid hotkey error message:

^h Down::
Send MARKERHERE{SPACEBAR}
Return

^h Up::
Send ^h
Return
Remove the "Down." By default, hotkeys fire on the down press, rather than on release, so the "Down" is unneeded.
ndiaz
Posts: 73
Joined: 10 Jan 2017, 17:05
Contact:

Re: Perform action before original hotkey function

24 Mar 2019, 23:31

Thank you! Both proposed solutions worked.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 352 guests