It has been renamed "MCLogger.ahk" and the actual log is now a separate text file called MCLog.txt. After running an analysis of the logged hotstrings, the top most-frequently-occurring items are presented in a radio group so you can optionally select an item to cull from the log, and add to your AutoCorrect2 file. There's no point in scanning them over and over if you've already added the item to your ac2 script... The tool culls them out of the log so that you don't have to manually find and remove them. The "adding to your AutoCorrect script" part has two options. If you set this variable to "1" (number one):
Then the MCLogger tool will open the selected hotstring in ac2's HotString Helper form, so that you can Examine it for possible conversion into a multi-match word middle item. Important: I updated AutoCorrect2.ahk to accept this command line parameter just today--so get the newest version of it for this feature to work. If you leave it set at 0, the item just gets appended to the end of the ac script.
Be sure to look over the other user options near the top of the code as well.
I've left my own logged items in the MCLog.txt file, but, as always, you should remove my logged items and log your own, that are based on your own typing patterns.
The image shows the progress-of-analysis progress bar, and below it the radio buttons (that appear after progress gets to 100%). WARNING: Pressing the [Cull and Append] button will absolutely remove the item from your log... So you might want to make a backup copy of your log file first (the tool does NOT create a backup for you). Edit: Now pressing the [Cull and Append] button will show a msgbox, prompting the user to optionally make a backup of the log each time. EDIT 2: I didn't like the MsgBox, to I replaced it with a "make a backup" checkbox on the bottom of the form. (below screenshot updated.)
Other changes on 5-5-2024: New log icon. New menu item (open log file). Esc now closes the cull-n-append Gui.
As an extra note: I've been collecting my typos/corrections for a few months and have a couple of thousand items. You won't see the highest-frequency items in my log data, because they's already been culled from the log and added to AutoCorrect2.
EDIT: Please pronounce it to yourself as "M. C. Log" and not "Mc Log," or "M. Clog." LOL.
On a serious note: Here are a couple of Gifs...
Spoiler
With this one, I run the analysis and then those the top item (which has a 'frequency of occurrence' of 7, meaning that it is a typo that I make fairly often). When I click the [Cull and Append] button, it (rather than just appending) sends the hotstring to HotString Helper to be examined. I check to see if the item can be used as a multi-match word-middle, -beginning, or -ending. The replacement "this" does match many items, but unfortunately, the trigger "thes" also matches several items, and so will misspell them if I make this a multi-match item. Since the entire four character string "thes" already misspells things, there is no point doing any left/right trims... That would just make it misspell even more words.
With this next gif, I've opened my AutoCorrects file and browsed to the bottom (where the recently-appended items are). I had appended a couple of items strait to the file before adding the feature to send them directly to HH. So I selected one and pressed the Win+H hotkey. The item was captured and I was able to Examine the item with HH's Exam Pane. When I clicked [Append] a validity warning appearded, but it was detecting the item that I had just selected--So all good.
Additional comment: If the SendToHH variable is set to 0 (zero), then the item that gets appended to ac2 is a plain vanilla hotstring... It is not formatted with the f() syntax.
Last edited by kunkel321 on 11 Jun 2024, 13:23, edited 3 times in total.
Interesting glitch.... There is a word beginning item for rre --> re it's a pretty high-utility item... Potentially fixes 8199 words (according to a word list of 249k words). See screenshot.
Spoiler
Unfortunately, it occasionally changes AutoCorrect --> AutoCorect. I figured-out that it happens if I accidentally do a double-capital, "AutoCOrrect." I'm pretty sure that the AUto-COrrect TWo COnsecutive CApitals script is resetting the hotstring recognizer when it fixes my double-cap. That causes AHK to interpret the subsequent text "rrect" as a word-beginning.... I will fix (hopefullly).
EDIT: Cannot fix... Also it's not related to the AUto-COrrect TWo COnsecutive CApitals script. See post here: viewtopic.php?f=82&t=129634
My hotstrings are all in ::trigger::_HS("replacement",% backspaceCount) format. Do you have any recommendations for how to reconcile with the new format?
If we want an _HS() version of hh2, we'll need to see if andymbody will make a related version of the big regex for us...
Correct me if I am wrong @kunkel321, will this resolve this question? It should now allow any function name. Is this all that needs to be addressed in the needle? I have not tested it. hsRegex := "(?Jim)^:(?<Opts>[^:]+)*:(?<Trig>[^:]+)::(?:\w+\((?<Repl>[^,)]*)[^)]*\)|(?<Repl>[^;\v]+))?(?<fCom>\h*;\h*(?:\bFIXES\h*\d+\h*WORDS?\b)?(?:\h;)?\h*(?<mCom>.*))?$"
@Jasonosaj can you replace this line with this needle to see if it works?
Hi @andymbody, if you are up for it/have time....
I'm working on a verision of HotstringHelper for Descolada's _HS function. I tried to adjust your regex, but it doesn't work. Here is what I was working on, and some test strings to match...
Notes:
-This is only for the _HS() tool. My f() version will keep using the Jim 156, that you made a few months ago. So the "FIXES X WORDS" part can be stripped away. The overall full comment should still be captured though.
-Also, _HS() supports (an optional) second parameter. I believe the second param can potentially have [A-Za-z0-9] characters. EDIT: I guess maybe a hyphen/minus sign should also be captured.
-Of course it should still capture plain vanilla autohotkey hotstrings too.
This will capture the single or double quotes in Repl and/or Par2. Let me know if this should not be allowed. You can always trim them, or tweak the needle to not capture them. If your tweak doesn't work, let me know. Also your description did not include underscore, but I included it as well - remove as desired. I also provided the full function capture in case that is ever needed.
HS Jim 137 (?Jim)^:(?<Opts>[^:]+)*:(?<Trig>[^:]+)::(?:(?<hs>_HS\((?<Repl>[0-9a-z_'"-]+)(?:,\h*(?<par2>(?&Repl)))?\))|(?<Repl>(?&Repl)))(?<Comm>.*)?$
or
HS Jim 132 (if underscore is allowed) (?Jim)^:(?<Opts>[^:]+)*:(?<Trig>[^:]+)::(?:(?<hs>_HS\((?<Repl>[\w'"-]+)(?:,\h*(?<par2>(?&Repl)))?\))|(?<Repl>(?&Repl)))(?<Comm>.*)?$
And note that the syntax highlighting in VSCode seems to think a quoted string (the brown) end right before the closing bracket.
While I was posting this, it occurred to me to wrap Jim in single-quotes rather than double quotes. If I do that, then syntax highlighting is correct (all brown), but I still get an error. This way it's
---------------------------
JimTest5-7-2024.ahk
---------------------------
opts *?
trig mytrig1
repl _HS
par2
comm ("myrepl1", "bs2") ; Comment blah
---------------------------
OK
---------------------------
---------------------------
JimTest5-7-2024.ahk
---------------------------
opts
trig mytrig2
repl _HS
par2
comm ("myrepl2", "O")
---------------------------
OK
---------------------------
---------------------------
JimTest5-7-2024.ahk
---------------------------
opts
trig mytrig3
repl _HS
par2
comm ("myrepl3") ; comment
---------------------------
OK
---------------------------
---------------------------
JimTest5-7-2024.ahk
---------------------------
opts C
trig mytrig4
repl myrepl4
par2
comm
---------------------------
OK
---------------------------
---------------------------
JimTest5-7-2024.ahk
---------------------------
opts
trig mytrig5
repl myrepl5
par2
comm
---------------------------
OK
---------------------------
Maybe I broke it when I took the two quote marks out(?)
EDIT 3: Also, no need to capture the "_HS" function name... Just need the things to populate the main Hotstring Helper form. Opts, Trig, Repl, Par2, Comm.
@kunkel321, for a real mention, you need mention-tags around the user name.
You can also type @ and then the beginning of the user name, and then choose from the dropdown as soon as it populates. This will add the tags automatically:
@kunkel321, for a real mention, you need mention-tags around the user name. ..
Yeah, usually I just type the @fistletters and the popup up appears (though there is often a long delay). It didn't occur to me to just manualy add the code.
EDIT: There we go!
It didn't occur to me to just manualy add the code.
Maybe you can make a hotstring! (for mention). That's what I did for the '=' version of links on here (paste link from clipboard). You helped me learn that... thank you btw.
Maybe you can make a hotstring! (for mention). That's what I did for the '=' version of links on here (paste link from clipboard). You helped me learn that... thank you btw.
You are welcome! Can you share your script for adding the links? I've been meaning to make one (since there isn't a toolbar button in the forum post editor). I just haven't gotten around to it.
Edit: Actually... Here's an attempt. I tried to make it work like MS Office apps... Once you've copied the url to the clipboard, select the text that you want to make into a link, then press Ctrl+K.
Here is mine (but I'm an amateur, lol). I copy the link normally (from address bar), then while in the forum-post-edit-box I use the /iu hotstring to format the link. The cursor is placed in the "friendly text" position so I can add the text I want the link to display. I like how you added the HotIf... I will have to look to see if this can be done with hotstrings also (I assume it can).
I have not tried yours yet, but it's interesting that you are performing both pastes at same time. Better idea in many cases.
@kunkel321
I've noticed a glitch that is happening in the "AutoCorrect2.ahk" and also was happening in the "AutoCorrectV2.ahk" version. here is what it does:
image.png (3.52 KiB) Viewed 381 times
(keep in mind that even though the popup shows the old style ::doesnt::doesn't, I am actually using the f("doesn't") scripting.)
it somehow puts two apostrophes into contractions.
the weird thing is that this only happens after the system has been up and running for a while. and the problem sometimes just goes away. it happens for all contractions, it seems.
When I get extra (duplicate) characters, I find that it is often because there are two instances of AutoCorrect2.exe running. Check the WinSysTray and see if there are two icons.
In theory, this should never happen because the #SingleInstance directive should prevent it. It happens especially often if I open the AutoCorrect2.ahk in VSCode, and reload it via the VSCode hotkey Ctrl+F9. It's really annoying. I'll try to add a mechanism for it to check for itself on start up.
Insidently, when I just tried the autocorrect item I got a completely different error: doesnt ---> doesent LOL. Iv'e recently added several new strings from my MCLog.... It must be one of those causing it.
When I get extra (duplicate) characters, I find that it is often because there are two instances of AutoCorrect2.exe running. Check the WinSysTray and see if there are two icons.
In theory, this should never happen because the #SingleInstance directive should prevent it. It happens especially often if I open the AutoCorrect2.ahk in VSCode, and reload it via the VSCode hotkey Ctrl+F9. It's really annoying. I'll try to add a mechanism for it to check for itself on start up.
Insidently, when I just tried the autocorrect item I got a completely different error: doesnt ---> doesent LOL. Iv'e recently added several new strings from my MCLog.... It must be one of those causing it.
I don't have two versions of the script running. I've confirmed this. it is odd that this happens only temporarily and after I've been typing a while.
another symptoms that I notice is that the system seems to be in the "AltDown" state at times. I have to press and release the alt button to get my F3 Button to work as F3, instead of Alt-F3. odd.
yes, I was having that doesnt --->doesent problem for a while but I found the offender and removed it. it is