Code: Select all
#IfWinActive, ahk_exe WINWORD.EXE
F2::
ClipSaved := ClipboardAll
Clipboard := "" ; empty the clipboard
Send, {CTRLDOWN}c{CTRLUP}
if (Clipboard = "") {
SendInput, ^+{Left}
SendInput, ^c
ClipWait, 0.5
Send, ("
Send, ^{s}%Clipboard%+{F3}^{s}
Send, ")
}
else {
Send, ("
Send, ^{s}%Clipboard%+{F3}^{s}
Send, ")
}
return
becomesparties
The script works reasonably well, except when I have to format more than one word, when it will only capitalize the last word. So("Parties")
becomemultiple words
when ideally it would be("multiple Words")
That happens because I am using Microsoft Word's shortcut to cycle between all lowercase, ALL UPPERCASE and Capitalized Initials. The shortcut is F3, but it might be a different one if you are using Microsoft Word in a different language (mine is in Portuguese). Another problem derived from that is that if the word is already capitalized when I hit the hotkey, it'll cycle to all uppercase, so that("Multiple Words")
becomesmultiple Words
So, what I want is a way to make the first letter of each word in the Clipboard upper case and all the other ones lower case, regardless of how they were initially. Is such a thing possible?("multiple WORDS")