Esc Key Not Working Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
JohnMartok
Posts: 8
Joined: 18 Sep 2022, 19:22

Esc Key Not Working

Post by JohnMartok » 28 Sep 2022, 09:33

Hi, I'm trying to make a script that copies the website address bar in Firefox to the clipboard. This simple script works great except that it won't close out the drop down part that shows up when you select the website address. Pressing Esc manually works though. I have tried running this script as Admin and using $Esc:: instead of {Esc}. Using esc by itself also works (using another to key to press esc). I'm not sure what's wrong.

Code: Select all

F3::Send, ^l
Send, ^a
Send, ^c
Send, {Esc}

return
Thanks!

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

Re: Esc Key Not Working  Topic is solved

Post by mikeyww » 28 Sep 2022, 10:09

A command on the same line as the hotkey means that it has an implicit Return after that single command. Thus, lines 2-6 in your script are never reached.

Code: Select all

#IfWinActive ahk_exe firefox.exe
F3::
Clipboard =
Send ^l^a^c
ClipWait, 0
If ErrorLevel
 MsgBox, 48, Error, An error occurred while waiting for the clipboard.
Send {Esc}
MsgBox, 64, Clipboard, %Clipboard%
Return
#IfWinActive

JohnMartok
Posts: 8
Joined: 18 Sep 2022, 19:22

Re: Esc Key Not Working

Post by JohnMartok » 28 Sep 2022, 12:13

Thanks! I'm new to scripting and didn't realize what a difference that could make. It works now!

Post Reply

Return to “Ask for Help (v1)”