Autocorrect question: second-letter non-capitalized?

Everything related to our flagship word processor.
Post Reply
michiganuser19
Posts: 23
Joined: 2010-11-06 08:10:38

Autocorrect question: second-letter non-capitalized?

Post by michiganuser19 »

I'm a new user of NWP -- still learning the ropes as I convert from MS Word. So far I love it!

One small quirk, though. Word had the capacity to autocorrect when I inadvertently type two capitals to start a word -- something I do too often, probably when I'm typing too fast. For example, I d :?: on't live in the UNited STates, and it would be nice if NWP would know to correct that spelling to United States.

Of course I can tell the program to do this individually -- ie to program corrections of THis to This, THat to That, etc., but obviously that's going to take eons given all the possible words with which sentences may start.

Is there a way to program this correction strategy automatically?

THank you! (:
Groucho
Posts: 497
Joined: 2007-03-03 09:55:06
Location: Europe

Re: Autocorrect question: second-letter non-capitalized?

Post by Groucho »

Hello michiganuser and welcome.

Presently NWP doesn’t sport such feature. You can run this macro, though:

Code: Select all

Find and Replace '\\b([A-Z])([A-Z]+)', '\\1\\T{lowercase:\\2}', 'Ea-i'
Like all macros, it doesn’t work on the spot. You have to run it manually when you want to do the fixing.
Note: the macro above will fix all-caps acronyms too (USAF will become Usaf), which maybe is not what you want. The macro below will only change the first two letters of a word:

Code: Select all

Find and Replace '\\b([A-Z])([A-Z])', '\\1\\T{lowercase:\\2}', 'Ea-i'
Greetings, Henry
rmark
Official Nisus Person
Posts: 428
Joined: 2003-02-11 10:49:05
Location: Solana Beach, CA
Contact:

Re: Autocorrect question: second-letter non-capitalized?

Post by rmark »

Hello michiganuser and welcome to Nisus Writer Pro.

Henry's suggestion is good, but, as he admits, it will also change NWP and USAF. I think the following macro will handle exactly what you want (so long as it's only the first two characters are UPPERCASE). If your pinkies are really heavy on the shift keys and your first three characters are UPPERCASE we have a more serious problem.

Code: Select all

Find and Replace '\\b([A-Z])([A-Z]([a-z])+)', '\\1\\T{lowercase:\\2}', 'Ea-i'
To clarify what the macro does: it searches for the beginning of a word that has two UPPERCASE characters followed by one or more lowercase characters. It then makes all but the first character lowercase.

I hope that helps. If you need any additional assistance, please let me know.
Write On!
Mark Hurvitz
Nisus Software Inc.
michiganuser19
Posts: 23
Joined: 2010-11-06 08:10:38

Re: Autocorrect question: second-letter non-capitalized?

Post by michiganuser19 »

Thanks very much -- that's precisely what I need. My fingers aren't usually so heavy that the caps persist into the third letter.

I'll need to figure out the macro side of NWP (haven't done that yet). Henry's note suggests that I will need to invoke the macro specifically whenever I want to carry out this correction -- i.e. that there is no way to have NWP simply automatically carry out this task -- correct?

if that's right, will your macro (or Henry's) search the entire file, and thus only need to be run once (when I finish my work/editing), or will it it correct only one occurrence of the problem, and thus need to be run repeatedly until all the double capitals are corrected?

Many thanks once again -- I appreciate both of your tips!!
michiganuser19
Posts: 23
Joined: 2010-11-06 08:10:38

Re: Autocorrect question: second-letter non-capitalized?

Post by michiganuser19 »

Never mind my last question -- I've just tried my first-ever NWP macro, and it worked absolutely perfectly. :)

If there were a way to build this capacity into the program (so it wouldn't require running a macro) that would be great. Something perhaps for a future version, as a clickable option in preferences? But for now this is excellent, and does just what I wanted. Many thanks -- I'm a happy camper!
michiganuser19
Posts: 23
Joined: 2010-11-06 08:10:38

Re: Autocorrect question: second-letter non-capitalized?

Post by michiganuser19 »

The only possible issues not covered by this macro involve two-letter words -- i.e. HE or IT or ON -- but those are easily programmed into autocorrection, as the number involved is vastly smaller ...
Groucho
Posts: 497
Joined: 2007-03-03 09:55:06
Location: Europe

Re: Autocorrect question: second-letter non-capitalized?

Post by Groucho »

Thanks Mark for your post. I realize I was a bit sloppy.
And…
michiganuser said:
The only possible issues not covered by this macro involve two-letter words -- i.e. HE or IT or ON -- but those are easily programmed into autocorrection, as the number involved is vastly smaller ...
This macro should work alright:

Code: Select all

$doc = Document.active
$text = $doc.text

if $doc.textSelection.length
	$opt = 'Ea-is'
	elsif ! $doc.textSelection.length
	$opt = 'Ea-i'
end

Find and Replace '\\b([A-Z])([A-Z][a-z]?)', '\\1\\T{lowercase:\\2}', $opt
Note: if you have an active selection, the macro will fix any double-caps within the selection. If you select nothing, the macro will process the entire file. If you want the macro to remember the selection (e.g. for further use) substitute Ea-isS for Ea-is in line 5.

Cheers, Henry.
michiganuser19
Posts: 23
Joined: 2010-11-06 08:10:38

Re: Autocorrect question: second-letter non-capitalized?

Post by michiganuser19 »

Thank you, Henry!
editor10
Posts: 36
Joined: 2010-09-18 12:24:52

Re: Autocorrect question: second-letter non-capitalized?

Post by editor10 »

Spell Catcher, http://www.rainmakerinc.com/, offers correction of doubled capitals, as a pref you can set.
Post Reply