hotstrings( "pat(\d+)l(\d+)\t", "position:absolute; top:%$1%px; left:%$2%px;" ) hotstrings( "pat(\d+)r(\d+)\t", "position:absolute; top:%$1%px; right:%$2%px;" ) hotstrings( "pab(\d+)r(\d+)\t", "position:absolute; bottom:%$1%px; right:%$2%px;" ) hotstrings( "pab(\d+)l(\d+)\t", "position:absolute; bottom:%$1%px; left:%$2%px;" ) hotstrings( "pr(\d+)\t", "padding-right:%$1%px;" ) hotstrings( "pl(\d+)\t", "padding-left:%$1%px;" ) hotstrings( "pt(\d+)\t", "padding-top:%$1%px;" ) hotstrings( "pb(\d+)\t", "padding-bottom:%$1%px;" ) hotstrings( "mr(\d+)\t", "margin-right:%$1%px;" ) hotstrings( "ml(\d+)\t", "margin-left:%$1%px;" ) hotstrings( "mt(\d+)\t", "margin-top:%$1%px;" ) hotstrings( "mb(\d+)\t", "margin-bottom:%$1%px;" ) hotstrings( "b(\d+)\t", "border:%$1%px solid #;" ) hotstrings( "fs(\d+|0.\d+)\t", "font-size:%$1%px;" ) hotstrings( "h(\d+)\t", "height:%$1%px;" ) hotstrings( "l(\d+)\t", "left:%$1%px;" ) hotstrings( "o(\d+|0.\d+)\t", "opacity:%$1%;" ) hotstrings( "p(\d+)\t", "padding:%$1%px;" ) hotstrings( "radius(\d+)\t", "border-radius:%$1%px; -moz-border-radius:%$1%px; -webkit-border-radius:%$1%px;" ) hotstrings( "r(\d+)\t", "right:%$1%px;" ) hotstrings( "t(\d+)\t", "top:%$1%px;" ) hotstrings( "w(\d+)\t", "width:%$1%px;" ) hotstrings( "z(\d+)\t", "z-index:%$1%;" ) /* Function: hotstrings Dynamically adds regular expression hotstrings. Parameters: c - regular expression hotstring a - (optional) text to replace hotstring with or a label to goto, leave blank to remove hotstring definition from triggering an action Examples: > hotstrings("(B|b)tw\s", "%$1%y the way") ; type 'btw' followed by space, tab or return > hotstrings("i)omg", "oh my god{!}") ; type 'OMG' in any case, upper, lower or mixed > hotstrings("\bcolou?r", "rgb(128, 255, 0);") ; '\b' prevents matching with anything before the word, e.g. 'multicololoured' License: - Version 2.56 - Simplified BSD License */ hotstrings(k, a = "") { static z, m = "*~$", s, t, w = 2000 global $ If z = ; init { Loop, 94 { c := Chr(A_Index + 32) If A_Index not between 33 and 58 Hotkey, %m%%c%, __hs } e = BS|Space|Enter|Return|Tab Loop, Parse, e, | Hotkey, %m%%A_LoopField%, __hs z = 1 } If (a == "" and k == "") ; poll { StringTrimLeft, q, A_ThisHotkey, StrLen(m) If q = BS { If (SubStr(s, 0) != "}") StringTrimRight, s, s, 1 } Else { If q = Space q := " " Else If q = Tab q := "`t" Else If q in Enter,Return q := "`n" Else If (StrLen(q) != 1) q = {%q%} Else If (GetKeyState("Shift") ^ GetKeyState("CapsLock", "T")) StringUpper, q, q s .= q } Loop, Parse, t, `n ; check { StringSplit, x, A_LoopField, `r If (RegExMatch(s, x1 . "$", $)) ; match { StringLen, l, $ StringTrimRight, s, s, l SendInput, {BS %l%} If (IsLabel(x2)) Gosub, %x2% Else { Transform, x0, Deref, %x2% SendInput, %x0% } } } If (StrLen(s) > w) StringTrimLeft, s, s, w // 2 } Else ; assert { StringReplace, k, k, `n, \n, All ; normalize StringReplace, k, k, `r, \r, All Loop, Parse, t, `n { l = %A_LoopField% If (SubStr(l, 1, InStr(l, "`r") - 1) == k) StringReplace, t, t, `n%l% } If a != t = %t%`n%k%`r%a% } Return __hs: ; event hotstrings("", "") Return }