Autohotkey 应用程序特定的热键 [英] Autohotkey application-specific hotkeys
问题描述
我是 Autohotkey 的新手,尽管阅读了本网站和官方文档,但我还是不明白这一点.
I am a newbie to Autohotkey, and I can't figure this out despite reading through this site and the official documentation.
我只想让某些热键仅适用于某些应用程序.例如,如果我在某个游戏中按空格键,我希望它发送`(严重),但如果我不在那个游戏中,我希望空格键正常运行.当我不在游戏中时,我尝试的一切似乎都使空格键不起作用.我可以尝试使用else"语句来发送空格键,但这似乎会造成无限循环.帮助!
I just want to have certain hotkeys work only with certain applications. So for example, if I press spacebar in a certain game I want it to send ` (grave), but if I'm not in that game I want spacebar to function normally. Everything I try seems to make spacebar do nothing when I'm not in game. I can try using an "else" statement to send the spacebar, but that just seems to make an infinite loop. Help!
谢谢 NbdNnm.这正是最终对我有用的东西:
Thank you NbdNnm. Here's exactly what ended up working for me:
#IfWinActive 英雄联盟 (TM) 客户端
空间::`
#IfWinActive
#IfWinActive League of Legends (TM) Client
Space:: `
#IfWinActive
推荐答案
试试这个,确保你有最新版本的 AutoHotkey.将应用程序进程名称放在 strYourAppExeName
变量中,并将热键定义放在 #if
块中.
Try this and make sure you have the latest version of AutoHotkey. Put the application process name in the strYourAppExeName
variable and put your hotkey definitions in the #if
block.
strYourAppExeName := "notepad.exe"
strYourMessage := "``(grave)"
#If WinActive("ahk_exe " strYourAppExeName)
Space::SendInput, % strYourMessage
#if
这篇关于Autohotkey 应用程序特定的热键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!