Autohotkey特定于应用程序的热键 [英] Autohotkey application-specific hotkeys

查看:575
本文介绍了Autohotkey特定于应用程序的热键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆