First, I thought it was a problem in Sublime Text's AutoHotKey package, SublimeAutoHotKey. So I removed it from ST and manually installed.
Then I opened a new small .ahk script I just created and hit Ctrl+B to have it built (run). It worked; the script which wasn't running fired up and showed its icon on the system tray. FYI the script has a single hotkey set, so it will keep running and showing its icon.
After editing it and hitting Ctrl+B in Sublime Text, it saved and executed the new version as expected. Good. Now it seems the problem is not in Sublime Text or the SublimeAutohotkey package.
Now the problem: my two main scripts, one for general macros and built-in subscripts (like NiftyWindows) and other for hotstrings (a lot now) can no longer be run from within Sublime Text. When I hit Ctrl+B to "build", it displays "building" in the status bar, but never updates to the latest version. The old version goes on running. Then, after a few seconds, it pops a message: "Could not close the previous instance of this script. Keep waiting?" I haven't had this problem until some weeks ago; prior to that, when I hit Ctrl+B, I could see the AHK icon in the system tray rapdly vanish then reload.
However, if those two scripts are not running, but their files are open in Sublime Text, hitting Ctrl+B will run them — and their icons will be loaded on the system tray. It just won't update if it's already running.
How to make it work again?
My scripts header boilerplates are as follows:
Code: Select all
SetWorkingDir, %A_ScriptDir% ; Ensures a consistent starting directory. Menu, tray, icon, ico/m.ico #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. #SingleInstance force Process, Priority, , High SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetTitleMatchMode, 2