(I suppose the answer will be a half-liner ..)
---------------
I want to start a script only when some special windows are active - so I think "WinActive" is the right was.
All windows are different, but similar. The ahk_class begins always with "WindowsForms10.Window.8.app........" - see attachment.
Should be simple, but I'm failing ...
What's the right code?
Thanks and have a fine evening?
Peter2
WinActive for many similar windows?
WinActive for many similar windows?
- Attachments
-
- ahk_class_dialogue.png (19.18 KiB) Viewed 641 times
Peter (AHK Beginner) / Win 10 x64, AHK Version v1.1.33
Re: WinActive for many similar windows?
No ideas? Maybe I described it more complicated then it is ....
WinActive should check all ahk_classes which begin with a defined string and ends with unknown strings, like ...
my.program.12
my.program.hey
my.program.23x-8
my.program.abc123.89.d
WinActive should check all ahk_classes which begin with a defined string and ends with unknown strings, like ...
my.program.12
my.program.hey
my.program.23x-8
my.program.abc123.89.d
Peter (AHK Beginner) / Win 10 x64, AHK Version v1.1.33
Re: WinActive for many similar windows?
1. If you want the script to start by itself when some particular window becomes active, you would
a. use a WinWait command to wait for the particular window to exist. You would specify Ahk_class for the Wintitle parameter and use SettitleMatchMode to handle a regular expression (which I can't help you with) to specify a pattern-matched ahk_class value.
2. If you want to manually kick off the script and have it do something if some particular window exists, you would do the same thing as above, but change the WinWait command to a WinExist() command and continue accordingly.
3. You could also use a WinGet command to create a list of windows matching certain criteria, loop through the list to see if a desired window exists and, again, continue accordlingly.
a. use a WinWait command to wait for the particular window to exist. You would specify Ahk_class for the Wintitle parameter and use SettitleMatchMode to handle a regular expression (which I can't help you with) to specify a pattern-matched ahk_class value.
2. If you want to manually kick off the script and have it do something if some particular window exists, you would do the same thing as above, but change the WinWait command to a WinExist() command and continue accordingly.
3. You could also use a WinGet command to create a list of windows matching certain criteria, loop through the list to see if a desired window exists and, again, continue accordlingly.
Who is online
Users browsing this forum: Chunjee, Google [Bot], haomingchen1998 and 123 guests