Can't run scripts from inside Sublime Text - "could not close previous instance of this script. Keep waiting?"

Get help with using AutoHotkey and its commands and hotkeys
Ross
Posts: 29
Joined: 13 Mar 2016, 00:27

Can't run scripts from inside Sublime Text - "could not close previous instance of this script. Keep waiting?"

22 Oct 2019, 04:50

I've been experiencing problems to reload my two main scripts after editing them on Sublime Text.

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
guest3456
Posts: 2651
Joined: 09 Oct 2013, 10:31

Re: Can't run scripts from inside Sublime Text - "could not close previous instance of this script. Keep waiting?"

09 Nov 2019, 13:37

Ross wrote:
22 Oct 2019, 04:50
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.
maybe you added something new to those scripts which caused it to start failing? do you rememer what you might have changed 2 weeks ago? i supposed the scripts are large but i dont know how else this may be debugged


Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], Bort P, Google [Bot], guest3456 and 215 guests