... i like to use AHK to effectively capitalize words, ...
Thanks for the kind words. Your situation does pose an interesting conundrum... The reason they aren't getting replaced, is because of the so called "rarification" process, as discuss above (here)
viewtopic.php?f=83&t=120220&start=20#p559621
The part of the code that does it is this:
CODE:
; Rarify: Only remove and replace rightmost necessary chars.
trigL := StrSplit(trigger)
replL := StrSplit(replace)
Global ignorLen := 0
Loop Min(trigL.Length, replL.Length) ; find matching left substring.
{If (trigL[A_Index] = replL[A_Index])
ignorLen++
else break
}
replace := SubStr(replace, (ignorLen+1))
SendInput("{BS " . (TrigLen - ignorLen) . "}" replace endchar) ; Type replacemement and endchar.
Since your trigger and replacement strings are the same, the code does zero backspaces, then types the first "zero" characters of the replacement string.
The rarification process makes sense when used as described above, but it totally messes up what you are doing there... You could try using this version of the code (I haven't actually tried it).
CODE:
f(replace := "") ; All the one-line autocorrects call this f(unction).
{static HSInputBuffer := InputBuffer()
HSInputBuffer.Start()
trigger := A_ThisHotkey, endchar := A_EndChar
Global lastTrigger := StrReplace(trigger, "X", "") "::" replace ; set 'lastTrigger' before removing options and colons.
SendInput(replace endchar) ; Type replacemement and endchar.
replace := "" ; Reset to blank string.
HSInputBuffer.Stop()
SoundBeep(900, 60) ; Notification of replacement.
addToLog := LastTrigger "`n"
GoLogger(addToLog) ; Uses same logger function as above CAse COrrector.
}
IMPORTANT: The autocorrect items all have B0 (B zero) in the hotstring options. You'll need to remove all of those, so that AutoHotkey uses its default behavior of auto-backspacing the triggers.
A relevant consideration though: Check out Descolada's ::trigger::_HS("replacement") function here:
viewtopic.php?p=565361#p565361
His has a built-in option to turn off the auto-backspacing, which is exactly what you need. The only downside is that his doesn't have the logging feature.
Last thing I'll point out: In my own autocorrect library, not all of my hotstrings use the f() function... It is only so I can log my accidental typo corrections. Other boilerplate template items just use plain vanilla hotstings. They can be put in the same ahk file... Just don't include the f() function call. You could do that for your capilizing items. If you do, I'd recommend the 'case sensitive' option, like this:
CODE:
:C:orif::ORIF
That will cause AHK to ignore when It's already typed in caps... Only typing it in lower-case will trigger the string.
Statistics: Posted by kunkel321 — Today, 14:09