2014-05-06 37 views
0

背景是我正在寫a small script用熱鍵彈出一個應用程序窗口,應用程序和熱鍵都可以使用ini文件進行自定義。我用AutoItv3完成了它,它對我來說工作正常。現在我正在考慮用AHK_L(首選)或Basic重新實現它,但我無法找到在AHK中執行dynamically binding hotkeys的替代方法,而在AutoIt中@HotKeyPresssed有助於討論here在AutoItv3中,作爲@HotKeyPressed,AHK_L或AHK Basic中的替代命令是什麼?

我在AutoItv3代碼基本上是這樣的:

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

@HotKeyPressed這裏使用的主要目標是打破HotKeySet()不能結合$Key運作_Main與參數的限制。

+0

我[德國](https://theweek.com/article/index/245258/8-of-our-favorite-ridiculously-long-german-words),甚至我發現函數名稱'ReadParametersFromIniFileAccordingToKey'太可笑了! – MCL

+0

我是一個新手程序員,我不知道什麼是正確的僞代碼,我來自中國大陸,並且......大聲笑,有你的幽默! 我會考慮你的答案btw。 – Joshz

+0

我認爲你可以想象包含8個單詞(39個字符)的函數名很難解析,即使它們在[PascalCase]中(http://msdn.microsoft.com/zh-cn/library/vstudio/ms229043 (v = VS.100)的.aspx)。這特別適用於像我們這樣的人(非母語人士)。一個好的名字imho可以像'ReadIni'或'FetchParameters',這取決於它的目的和你的個人喜好。 – MCL

回答

3

您正在查找A_ThisHotkey
實例:

a:: 
b:: 
c:: 
    MsgBox, You pressed %A_ThisHotkey%. 
return 
相關問題