I've been trying to make this script that only creates a new instance of Notepad when there are no blank instances (aka instances that have no text in the window) running, however, if there is a blank instance running it should switch to that instance.
I'm pretty new to ahk, so if there is a simpler way to do what I want I would also appreciate that answer as well.
Here is the code I have so far (I thought I would be able to utilize the WinExclude parameter of WinExist, but I couldn't find a way to denote the general presence of text, nor could I find a way to denote the absence of text within the WinText parameter):
Code: Select all
#n::
{
if WinExist("Untitled - Notepad")
WinActivate
else
Run "Notepad.exe"
}
Side Note: When I create a new instance of Notepad, the title is, "Untitled - Notepad" But when I type in that instance the title changes to, "*Untitled - Notepad" I thought that ahk would recognize this as a separate window when WinExist is called, but it seems to find no difference between them which made me confused. Also, I am running version 2.0.2
[Mod action: Moved to v2 section.]