启动特定应用程序时如何执行自动热键脚本

How to execute an autohotkey script when launching a specific application

我已经成功地使用了自动热键脚本来实现我想要的(从 windowed 游戏中删除标题栏和 window 框架):

;-Caption
LWIN & LButton::
WinSet, Style, -0xC00000, A
return
;

;+Caption
LWIN & RButton::
WinSet, Style, +0xC00000, A
return
;

我想要的是 "WinSet, Style, -0xC00000, A" 在启动特定应用程序时自动执行。

如有任何反馈,我们将不胜感激!

只需为游戏制作一个 AHK 启动器并使用它来代替快捷方式图标或任务栏图标或您用来启动游戏的任何其他东西。

Run, d:\somepath\game.exe
WinWait Game window title goes here
WinSet, Style, -0xC00000
ExitApp

虽然 wOxxOm 的回答是完全可以接受的。您还可以使用 Settimer 和 WinExist 在持久脚本中执行此操作。

#persistent 

SetTimer, isItRunning, 1000

isItRunning: 
if winexist("yourprogram")
     WinSet, Style, -0xC00000

Return