So you're saying when you run the script below, when you press the
Tab key, the script isn't paused? And when you press it again, it's not resumed?
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#Persistent
SetTimer, PressTheKey, 2500
Return
PressTheKey:
Send, 3
Return
Tab::Pause
Make sure you save the script file before running it. And make sure you don't have any other version of the script running that may be sending the 3. Look specifically at the tray icon for this script and see whether or not it turns from green to red (and back) when you press the
Tab key, indicating it is paused/un-paused. If you have some other script running that uses the
Tab key as a hotkey, then choose a different hotkey for this script.
I'm guessing when you first tried it and it didn't work, it was because you put it at or near the top of the script, before the
SetTimer command, which prevented that line from being executed because it was effectively removed from the
auto-execute section of the script. Then if it didn't work if/when you moved it somewhere below the
SetTimer, you must have had some other issue as I suggested above.