I've done a bunch of searching to get me to the point I'm at, but need some pointers...
I need F1 to function as normal, but if pressed twice within half a second, it opens Notepad++, then a new tab. This works, but when double pressing F1, it also sends the F1 key; so when in NPP, it pulls up the 'About' screen, etc. (The odd thing is that if I simplify the code so that the double press only pops up a test message box, it works...but of course I need it to plays some beeps an then open NPP etc.)
Code: Select all
$F1::
If (A_PriorHotKey = "$F1" AND A_TimeSincePriorHotkey < 500)
{
SoundBeep, 750, 250
Sleep, 250
SoundBeep, 1000, 250
Sleep, 250
SoundBeep, 1250, 250
Sleep, 250
GoSub MarkerForPressingF1KeyTwice
SetTimer, F1KeyPressDefault, Off
}
else
SetTimer, F1KeyPressDefault, -500
Return
F1KeyPressDefault:
Send, {F1}
Return
MarkerForPressingF1KeyTwice:
Process, Exist,- notepad++.exe
If Not ErrorLevel ; errorlevel will = 0 if process doesn't exist
Run, "C:\Program Files (x86)\Notepad++\notepad++.exe"
If (ErrorLevel != 0){
SetTitleMatchMode 2
WinWait,- Notepad++
IfWinNotActive,- Notepad++, WinActivate,- Notepad++
WinWaitActive,- Notepad++
}
Sleep, 500
Send {Ctrl Down}{Shift Down}{N}
Send {Ctrl Up}{Shift Up}
Return