 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Laszlo
Joined: 14 Feb 2005 Posts: 4016 Location: Pittsburgh
|
Posted: Thu Mar 01, 2007 12:10 am Post subject: |
|
|
| Chris wrote: | | some people (such as programmers) might find that it interferes with their typing too much. But I'm not really sure how common that is, so comments are welcome. | This script can be made a little more intelligent. E.g. when three capitals are typed in a row, we can keep them unchanged. | Code: | keys = ``1234567890-=qwertyuiop[]\asdfghjkl;'zxcvbnm,./
Loop Parse, keys
HotKey ~+%A_LoopField%, Hoty
Hoty:
CapCount := SubStr(A_PriorHotKey,2,1)="+" && A_TimeSincePriorHotkey<999 ? CapCount+1 : 1
IfEqual CapCount,2, SendInput % "{BS}" SubStr(A_ThisHotKey,3,1)
IfEqual CapCount,3, SendInput % "{Left}{BS}+" SubStr(A_PriorHotKey,3,1) "{Right}"
Return | Arbitrary rules can be set, like two shifted keys, followed by a non-alphanumeric character ("US ", "KM.") they can be kept. Here we could really use key history or on_keystroke:. One could also keep his own little (dynamic) dictionary for the words with two neighbor capitals. |
|
| Back to top |
|
 |
sawfoot
Joined: 27 Feb 2007 Posts: 3
|
Posted: Thu Mar 01, 2007 12:14 am Post subject: sawfoot |
|
|
All working now, great, thanks. I keep on trying to catch it out but it is always too quick for me.
Using it now the new amendment above makes sense, as you previously would have to use caps lock to type whole caps words, as holding shift wouldn't work it, so it makes it more usable. The non-alphanumeric character suggestion sounds good - preferable to a list of exclusions.
You can type things like US if you pause slightly currently - so I would recommend changing the 999ms to a lower figure - maybe around 300 from my testing.
You could always keep the improved version in, and comment it out with a note, or leave it in and allow people to comment out/delete if they wish - this would seem to be a good idea as casual users wouldn't be aware of its existence unless they delve into these forums. |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Thu Mar 01, 2007 2:04 am Post subject: |
|
|
I've added this to the script, but omitted autocorrection for digits and punctuation because I suspect they might do more harm than good (not sure). Also, I've made this section disabled by default because it sometimes causes unwanted corrections such as IfEqual->Ifequal. (I think a lot of people use this script, so I'm trying to avoid addihng features unless they're reasonably certain to do more good than harm for the general public.)
I also changed the style of the code to be more conventional, namely to avoid IfEqual and implicit concatenation:
| Code: | ;-------------------------------------------------------------------------------
; The following section auto-corrects two consecutive capital letters in a word.
; For example, "WOrd" becomes "Word". It is disabled by default since it might
; cause unwanted corrections such as IfEqual->Ifequal. To enable it, remove
; the /*..*/ symbols from around it.
; This section is from Laszlo's script at http://www.autohotkey.com/forum/topic9689.html
;-------------------------------------------------------------------------------
/*
; The first line of code below is the set of letters, digits, and/or symbols
; that are eligible for this type of correction. Customize if you wish:
keys = abcdefghijklmnopqrstuvwxyz
Loop Parse, keys
HotKey ~+%A_LoopField%, Hoty
Hoty:
CapCount := SubStr(A_PriorHotKey,2,1)="+" && A_TimeSincePriorHotkey<999 ? CapCount+1 : 1
if CapCount = 2
SendInput % "{BS}" . SubStr(A_ThisHotKey,3,1)
else if CapCount = 3
SendInput % "{Left}{BS}+" . SubStr(A_PriorHotKey,3,1) . "{Right}"
Return
*/ |
Refinements are welcome. Thanks for the script. |
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 4016 Location: Pittsburgh
|
Posted: Thu Mar 01, 2007 2:58 am Post subject: |
|
|
Handling some CamelCase words (like IfEqual) can be easily accomplished with a dummy hotkey, likeIt will change A_PriorHotKey, so the counting restarts at the next capital letter.
It is a good idea to exclude certain shifted keys, which are often duplicated: ##, &&, **, __, ++, ||, <<, >>. Others could remain.
In case of Ms Word, excluding ~, # looks necessary. For some unknown reasons, sometimes, after a space, they result in some extra or unexplained characters in the text. I did not experience this in other applications. |
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 4016 Location: Pittsburgh
|
Posted: Thu Mar 01, 2007 3:58 am Post subject: |
|
|
If you want to leave two capitals alone if they are followed by an un-shifted punctuation mark, try adding the following hotkeys to the script. | Code: | ~Shift Up:: ; handle CamelCase
key0 := SubStr(A_PriorHotKey,2,1)="+" && A_TimeSincePriorHotkey<999 && CapCount=2
? SubStr(A_PriorHotKey,3,1) : ""
Return
~.::
~,::
~'::
~"::
~-::
If (key0 <> "" && A_PriorHotKey = "~Shift Up" && A_TimeSincePriorHotkey<999)
SendInput % "{Left}{BS}+" key0 "{Right}"
Return | At Shift Up we check if the previous key was changed to lower case, within the last second. If yes, we save the changed key in the variable key0. The handled punctuation marks always come after a Shift Up. If not more than one second passed, we can correct key0 back to capital.
Of course, such simple scripts cannot be foolproof. If you move the insertion point or the active window changes within the critical second, the correction appears at the wrong place. We ought to know it, or if other keys were pressed. With proper key history we could remove the timing restrictions. |
|
| Back to top |
|
 |
sunil kanta swain Guest
|
Posted: Fri May 02, 2008 9:31 am Post subject: sub:how to permanently delete autocorrect from the ms word |
|
|
Hello,
i searched for permanently delete autocorrect from ms word.could u kindly to help me out for this kind of problem ?
Regards
sunil kanta swain,
system administration,
C Bay Systems (India) Pvt ltd,
Bangalore 560008
mail ID:sunilkanta033@gmail.com /sunil_swain37@yahoo.co.in |
|
| Back to top |
|
 |
sunil kanta swain Guest
|
Posted: Fri May 02, 2008 9:33 am Post subject: Re: sub:how to permanently delete autocorrect from the ms wo |
|
|
| sunil kanta swain wrote: | Hello,
i searched for permanently delete autocorrect from ms word.could u kindly to help me out for this kind of problem ?mail methe solution asap.
Regards
sunil kanta swain,
system administration,
C Bay Systems (India) Pvt ltd,
Bangalore 560008
mail ID:sunilkanta033@gmail.com /sunil_swain37@yahoo.co.in |
|
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|