[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

教學影片

##

您可能也會有興趣的類似文章

簡睿

服務於軟體業的資訊老兵。興趣廣泛,學習力佳,樂於分享所知所學。

您可能也會喜歡…

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *