We help IT Professionals succeed at work.

Autohotkey Script for Capitalization of Selected Text

oaktrees used Ask the Experts™
Need an Autohotkey script that will work for Title Case capitalization, and reverse of selected text.

Found this, but can't seem to get it to work.

Nor any way for it to EXCLUDE a set of words like "the", to", "and", "from", "for".

I quickly solved the retyping problem:

+^k:: ; SHIFT+CTRL+K converts text to capitalized
  Clipboard := ""
  SendInput, ^c ;copies selected text
  StringUpper Clipboard, Clipboard, T ; Title mode conversion
  SendInput %Clipboard%
This Hotkey mostly fixes the all-caps text by converting every word to initial caps. However, I did need to revert some prepositions and connectors to lowercase as appropriate (e.g. And ⇒ and, For ⇒ for, To ⇒ to, etc)

What do you think is happening?

Many thanks!!

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Fellow 2017
Most Valuable Expert 2018
Hi OT,

> but can't seem to get it to work

What's not working? I tested all three hotkeys at the link you posted...Shift+Ctrl+K, Ctrl+L, Ctrl+U...they all work perfectly here.

> Nor any way for it to EXCLUDE a set of words like "the", to", "and", "from", "for".

That code makes no attempt to do that. It could certainly be programmed in AutoHotkey to do it. For example, one idea is to create a simple plain text file with a list of exclusions, then after the capitalization, apply the exclusions. Regards, Joe


Dunno what I was doing but it IS working now! :))))))))))))))))))))

Thanks, Joe!
Joe WinogradDeveloper
Fellow 2017
Most Valuable Expert 2018

Hi OT,
You're welcome...and thanks back at you for writing the Testimonial...much appreciated! I'm very glad to hear that it's working now for you.

Regarding the ability to exclude words from the capitalization, I decided that is worthy of an enhanced AutoHotkey script and an EE article on it. Here's the link:

Exclude words when converting to "Title Case" - AutoHotkey Script

Please let me know how that works for you. Regards, Joe