简体   繁体   English

Autohotkey:确定Google Chrome与Google Chromium

[英]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 Google Chrome和Google Chromium都使用相同的ahk_classchrome.exe相同的.exe名称。

How does one use something like winTitle or winGet to distinguish the difference? 如何使用诸如winTitlewinGet类的东西来区分差异? I tried looking into PID values but they don't seem to be consistent. 我尝试查看PID值,但它们似乎不一致。

EDIT via WinSpy++ 通过WinSpy ++ 编辑

Using winspy++, I ran a simple experiment. 使用winspy ++,我进行了一个简单的实验。 2 Chromium Windows and 2 Chrome Windows so I can have a control group. 2个Chromium Windows和2个Chrome Windows,因此我可以有一个控制组。 Differences: 区别:

  • INSTANCE HANDLE: Chrome shows 0F2C0000 , Chromium shows A2820000 0F2C0000 :Chrome显示0F2C0000 ,Chromium显示A2820000
  • Process ID: Chrome shows 00003528 (13608) , Chromium shows 00001B74 (7028) 进程ID:铬显示00003528 (13608) ,铬显示00001B74 (7028)
  • Thread ID: Chrome shows 00003524 (13604) , Chromium 00000220 (544) 线程ID:Chrome显示00003524 (13604) ,Chromium 00000220 (544)

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: (1)使用SetTitleMatchMode 2和该程序的所有窗口共同拥有的标题部分:

SetTitleMatchMode 2
If WinExist("- Chromium")
    WinActivate

(2) Using " ahk_exe Path ": (2)使用“ ahk_exe路径 ”:

If WinExist("ahk_exe full_path_of_the_executable_chrome.exe")
    WinActivate

To get the full path of the active window process use this: 要获取活动窗口进程的完整路径,请使用以下命令:

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

Using Windows Spy (came with autohotkey). 使用Windows间谍程序(带有自动热键)。 Is not the same as winspy++ 与winspy ++不同

To access Windows Spy found here: 要访问在此处找到的Windows Spy:

在此处输入图片说明

Differences are found in WinTitle WinTitle中发现差异

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM