Dynamically add regular expression type hotstrings.
Example:
hotstrings("now#", "%A_Now%") hotstrings("(B|b)tw", "%$1%y the way") hotstrings("(\d+)\/(\d+)%", "percent") ; try 4/50% Return percent: p := Round($1 / $2 * 100) Send, %p%`% ReturnDownload
Dynamically add regular expression type hotstrings.
Example:
hotstrings("now#", "%A_Now%") hotstrings("(B|b)tw", "%$1%y the way") hotstrings("(\d+)\/(\d+)%", "percent") ; try 4/50% Return percent: p := Round($1 / $2 * 100) Send, %p%`% ReturnDownload
autohotkey.com/net Site Manager
Contact me by email (polyethene at autohotkey.net) or message tidbit
Dynamically add regular expression type hotstrings.
It does, that was probably a bad example. Try hs("gr[ea]y", "{#}CCC") - it replaces 'grey' or 'gray' with its hex colour code.Does this script not effectively add regex support to hotstrings?
autohotkey.com/net Site Manager
Contact me by email (polyethene at autohotkey.net) or message tidbit
hs("(B|b)tw\W", "%$1%y the way")
Does that work for you? Because that doesn't get expanded at all for me. (FWIW, I also thought about using regular expressions to try to test for end-of-word characters, but couldn't get it to work.)please try
hs("(B|b)tw\W", "%$1%y the way")
hs(c, a = "") { static d, b, q global $ v = `n,€,~$,Numpad,BS[color=red],Space[/color] StringSplit, v, v, `, If !d { Loop, 104 Hotkey, % Chr(42 * !!RegExMatch(t := Chr(32 + (x := A_Index)) , "[a-z]")) . v3 . (x > 94 ? v4 . x - 95 : t), _hs Hotkey, %v3%%v5%, _hs [color=red]d := 1[/color] } If a Return, !!b .= c . v2 . a . v1 If c = %v3%%v5% Return, !!q := SubStr(q, 1, -1) [color=red] If c = %v3%%v6% Return, !!q := SubStr(q, 1, -1)[/color] If GetKeyState("Shift", "P") or GetKeyState("Capslock", "T") StringUpper, c, c Else StringLower, c, c q .= SubStr(c, StrLen(v3) + !!InStr(c, v4) * StrLen(v4) + 1 + !!InStr(c, "*")) Loop, Parse, b, %v1% { If (c := RegExMatch(q, SubStr(t := A_LoopField, 1 , InStr(t, v2) - 1) . "$", $)) and t { f += RegExMatch(t, ".+" . v2 . "(.+)", l) SendInput, % "{BS " . StrLen($) . "}" Transform, l, Deref, %l1% If IsLabel(l) GoSub, %l% Else SendInput, %l% } } If f q = } [color=red]~$space:: [/color] _hs: hs(A_ThisHotkey) Return
hs(c, a = "") { static d, b, q global $ v = `n,€,~$,Numpad,BS,Space[color=red],Tab,Return[/color] StringSplit, v, v, `, If !d { Loop, 104 Hotkey, % Chr(42 * !!RegExMatch(t := Chr(32 + (x := A_Index)) , "[a-z]")) . v3 . (x > 94 ? v4 . x - 95 : t), _hs Hotkey, %v3%%v5%, _hs d := 1 } If a Return, !!b .= c . v2 . a . v1 If c = %v3%%v5% Return, !!q := SubStr(q, 1, -1) If c = %v3%%v6% Return, !!q := SubStr(q, 1, -1) [color=red] If c = %v3%%v7% Return, !!q := SubStr(q, 1, -1) If c = %v3%%v8% Return, !!q := SubStr(q, 1, -1)[/color] If GetKeyState("Shift", "P") or GetKeyState("Capslock", "T") StringUpper, c, c Else StringLower, c, c q .= SubStr(c, StrLen(v3) + !!InStr(c, v4) * StrLen(v4) + 1 + !!InStr(c, "*")) Loop, Parse, b, %v1% { If (c := RegExMatch(q, SubStr(t := A_LoopField, 1 , InStr(t, v2) - 1) . "$", $)) and t { f += RegExMatch(t, ".+" . v2 . "(.+)", l) SendInput, % "{BS " . StrLen($) . "}" Transform, l, Deref, %l1% If IsLabel(l) GoSub, %l% Else SendInput, %l% } } If f q = } ~$space:: [color=red]~$return:: ~$tab::[/color] _hs: hs(A_ThisHotkey) Return