Page 1 of 1

Help with activating code only on a Certain window.

Posted: 07 Jan 2024, 00:32
by mexican scientist
There was a code I had like this:

Code: Select all

#IfWinActive, Hitman 3
code goes here...
The code activated only one the window called "Hitman 3"

But now, the code does not work. However, If i remove the line

Code: Select all

#IfWinActive, Hitman 3
, the code works, but it activates everywhere, and I just want the code to be available on the window called "Hitman 3"

Any help is appreciated.

Re: Help with activating code only on a Certain window.

Posted: 07 Jan 2024, 03:50
by Rohwedder
Hallo,
I don't know this game, but maybe the window name has changed? Perhaps an invisible character, e.g. zero-width space, has been added?
https://en.wikipedia.org/wiki/Zero-width_space

Re: Help with activating code only on a Certain window.

Posted: 07 Jan 2024, 06:52
by mikeyww
From Wikipedia:
In 2023, IO rebranded Hitman 3 as Hitman: World of Assassination, with the contents of the previous two Hitman games becoming available to Hitman 3 owners.
Run Window Spy to see the WinTitle information.

Re: Help with activating code only on a Certain window.

Posted: 07 Jan 2024, 17:59
by mexican scientist
mikeyww wrote:
07 Jan 2024, 06:52
From Wikipedia:
In 2023, IO rebranded Hitman 3 as Hitman: World of Assassination, with the contents of the previous two Hitman games becoming available to Hitman 3 owners.
Run Window Spy to see the WinTitle information.
It turns out that the title was in capital letters. HITMAN 3

Now it works, thanks everyone for taking your time in providing feed back.

Re: Help with activating code only on a Certain window.

Posted: 07 Jan 2024, 18:24
by mikeyww
Good. Yes, when AHK assess window titles, this is always case-sensitive by default.

Explained in the documentation for WinTitle.
Window titles are case-sensitive, except when using the i) modifier in a RegEx pattern.