[AHK#52] 1.1.28新功能:Function Hotstring
原來AutoHotkey自從1.1.28版開始已經提供了稱為Function Hotstrings的功能了,簡單理解就是能在熱字串裡寫腳本程式碼了。
另外,也可以使用Hotstring函數動態控制熱字串。
1. 範例
#SingleInstance Force
; This example also demonstrates one way to implement case conformity in a script.
:C:BTW:: ; Typed in all-caps.
:C:Btw:: ; Typed with only the first letter upper-case.
: :btw:: ; Typed in any other combination.
btw() {
hs := A_ThisHotkey ; For convenience and in case we're interrupted.
if (hs == `":C:BTW")
Send BY THE WAY
else if (hs == ":C:Btw")
Send By the way
else
Send by the way
}
::tst::
SendInput #e
return
::aa:: Hotstring(": :btw", "new BTW string")
::bb:: btw()
::cc::
btw()
return
::dd::
try
Hotstring("::btw", " bb tt ww")
catch
MsgBox The hotstring does not exist or it has no variant for the current IfWin criteria.
return
相關鏈接
✅ Function Hotstrings: https://www.autohotkey.com/docs/Hotstrings.htm#Function
✅ Hotstring: https://www.autohotkey.com/docs/commands/Hotstring.htm
教學影片
##
您可能也會有興趣的類似文章
- 快速建立個人常用詞庫-AutoHotkey 熱字串小工具:HotString Helper(AHK #3) (0則留言, 2019/05/18)
- [AHK#54] 用AutoHotkey快速輸出Markdown標題井號(Hashes) (0則留言, 2022/08/06)
- [Tools] 常用的AutoHotKey設定 (9則留言, 2005/05/12)
- 輕鬆學會AutoHotkey的熱鍵:熱鍵用法實例解說(AHK #4) (2則留言, 2019/05/24)
- 支援Unicode的Autohotkey終於浮上抬面! (3則留言, 2010/10/16)
- AHK63|AutoHotkey V2 語言概述#1-字串、熱字串與變數 (0則留言, 2024/03/30)
- [Tools] 操作熱鍵與熱字串的超便利工具:AutoHotKey (13則留言, 2005/04/29)
- 幾個AutoHotkey的實用範例:音量控制、滾輪回上層與語音功能(AHK #7) (3則留言, 2019/06/05)
- AutoHotkey腳本的4種除錯方法(AHK #5) (0則留言, 2019/05/25)
- 輕鬆學會彈指神功-揭露AutoHotkey絕技 (63則留言, 2008/04/10)
- [AHK-56] 瀏覽器鏈接快速另存圖片 (0則留言, 2022/09/18)
- 用AutoHotkey統一不同工具的偵錯功能鍵 (0則留言, 2008/03/19)
- 用AutoHotkey輕鬆製作螢幕小鍵盤 (16則留言, 2008/03/16)
- 改寫AutoHotkey輸出中文字串的寫法 (4則留言, 2009/06/20)
- AutoHotkey輸出中文的方法 (19則留言, 2008/03/01)
Sorry, 很久沒用Google sc…