Vincent Tang
Vincent Tang

Reputation: 4170

Autohotkey: Identify Google Chrome vs Google Chromium

I can't seem to figure this out

On autohotkey, there's documentation on how to identify a window / program running.

Google Chrome and Google Chromium both use the same ahk_class and the same .exe name of chrome.exe

How does one use something like winTitle or winGet to distinguish the difference? I tried looking into PID values but they don't seem to be consistent.

EDIT via WinSpy++

Using winspy++, I ran a simple experiment. 2 Chromium Windows and 2 Chrome Windows so I can have a control group. Differences:

Upvotes: 1

Views: 580

Answers (3)

Relax
Relax

Reputation: 10593

To get the full path of the active window process use this:

F1::
    WinGet, Path, ProcessPath, A
    MsgBox, %Path%
return

Upvotes: 1

Relax
Relax

Reputation: 10593

In this case you have two possibilities to distinguish between the two programs:

(1) Using SetTitleMatchMode 2 and the part of the title that all windows of this program have in common:

SetTitleMatchMode 2
If WinExist("- Chromium")
    WinActivate

(2) Using "ahk_exe Path":

If WinExist("ahk_exe full_path_of_the_executable_chrome.exe")
    WinActivate

Upvotes: 1

Vincent Tang
Vincent Tang

Reputation: 4170

Using Windows Spy (came with autohotkey). Is not the same as winspy++

To access Windows Spy found here:

enter image description here

Differences are found in WinTitle

enter image description here

Upvotes: 0

Related Questions