简体   繁体   English

在AutoItv3中,AHK_L或AHK Basic中@HotKeyPressed的替代命令是什么?

[英]What's the alternative command in AHK_L or AHK Basic as @HotKeyPressed in AutoItv3?

The background is I'm writing a small script to pop up an application window with hotkeys, both application and hotkey can be customized with an ini file. 背景是我正在编写一个小脚本以使用热键弹出应用程序窗口,可以使用ini文件自定义应用程序和热键。 I've completed it with AutoItv3 and it works fine for me. 我已经用AutoItv3完成了它,对我来说很好用。 Now I'm considering re-implementing it with AHK_L(preferred) or Basic, yet I can't find the alternative way of doing dynamically binding hotkeys in AHK while in AutoIt @HotKeyPresssed is helpful as discussed here . 现在我考虑与AHK_L(首选)或基本重新实现它,但我找不到这样做的另一种方式dynamically binding hotkeys在AHK而在AutoIt的@HotKeyPresssed是有帮助的讨论在这里

My code in AutoItv3 is basically like this: 我在AutoItv3中的代码基本上是这样的:

For 1 to $NumberOfKeys
   $Key = ReadOneKeyFromIniFile()
   HotKeySet($Key,"_Main")
Next
Func _Main()
   $AppKeyBind = @HotKeyPressed
   $Parameters = ReadParametersFromIniFileAccordingToKey($AppKeyBind)
   PopUpWindowWithHotKey($Parameters)
EndFunc

@HotKeyPressed used here is mainly aiming to break the limitation that HotKeySet() can't bind $Key to function _Main with parameters . @HotKeyPressed使用的@HotKeyPressed主要目的是打破HotKeySet()无法将$Key绑定到具有参数的函数_Main的限制。

You're looking for A_ThisHotkey . 您正在寻找A_ThisHotkey
Example usage: 用法示例:

a::
b::
c::
    MsgBox, You pressed %A_ThisHotkey%.
return

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

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