Page 1 of 1

WinSetTitle breaks #SingleInstance Force

Posted: 26 Sep 2017, 01:07
by pneumatic
Renaming the script's own window, even to the same name it's normally given by AHK, causes #SingleInstance Force to no longer work


Re: WinSetTitle breaks #SingleInstance Force

Posted: 26 Sep 2017, 06:31
by jeeswg
If you change it to exactly the same title, #SingleInstance force still appears to work, but yes, in the general case, this is very surprising.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus


Re: WinSetTitle breaks #SingleInstance Force

Posted: 26 Sep 2017, 08:10
by just me
To determine if a script is already running AHK is searching for windows of class AutoHotkey (hidden main window) with exactly the same title the new main window would get on creation. This is actually a rather simple method but has been sufficient for many years. Apparently, nobody using #SingleInstance, Force had a reason to change the main window's title as yet.

We could add something like
You must not change the title of the script's hidden main window if you want to prevent new instances of the script from being launched.
to the docs.