WinSetTitle breaks #SingleInstance Force

Report problems with documented functionality
pneumatic
Posts: 110
Joined: 05 Dec 2016, 01:51

WinSetTitle breaks #SingleInstance Force

26 Sep 2017, 01:07

Renaming the script's own window, even to the same name it's normally given by AHK, causes #SingleInstance Force to no longer work

User avatar
jeeswg
Posts: 2228
Joined: 19 Dec 2016, 01:58
Location: UK

Re: WinSetTitle breaks #SingleInstance Force

26 Sep 2017, 06:31

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

just me
Posts: 4685
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: WinSetTitle breaks #SingleInstance Force

26 Sep 2017, 08:10

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.
Remaining with AHK 1.1.25.02 until v2 will become beta.

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 1 guest