I would like a script that when I press F12 it will open a URL and when I hold down F12 for 0.5 seconds it will open notepad instead of the URL. I've got this partially working, but I can't figure out how to prevent it opening the URL when it is held down to open notepad. My attempt for your consideration is below.
Code: Select all
$F12::
Run https://www.autohotkey.com
KeyWait,F12,T0.5 ;wait 0.5 seconds for release key
If (ErrorLevel) ;more than 0.5 sec have passed
{
Run C:\Windows\System32\Notepad
KeyWait,F12 ;prevent launching URL after notepad opened
}
Return