Help with activating code only on a Certain window.

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
mexican scientist
Posts: 33
Joined: 02 Jul 2020, 21:55

Help with activating code only on a Certain window.

07 Jan 2024, 00:32

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.
Rohwedder
Posts: 7719
Joined: 04 Jun 2014, 08:33
Location: Germany

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

07 Jan 2024, 03:50

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
User avatar
mikeyww
Posts: 27191
Joined: 09 Sep 2014, 18:38

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

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.
mexican scientist
Posts: 33
Joined: 02 Jul 2020, 21:55

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

07 Jan 2024, 17:59

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.
User avatar
mikeyww
Posts: 27191
Joined: 09 Sep 2014, 18:38

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

07 Jan 2024, 18:24

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.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: CoffeeChaton, peter_ahk and 181 guests