Capitalize first letter of word where cursor at

Get help with using AutoHotkey and its commands and hotkeys
mcquicker
Posts: 3
Joined: 04 Oct 2019, 16:54

Capitalize first letter of word where cursor at

06 Oct 2019, 09:30

I'm trying to find a way to assign one key (e.g. \) to capitalize the first letter of "any word" where cursor may be at.

For instance if I'm in the middle of a sentence and like this one, and would like to capitalize one of its words, I'd like to place the cursor on the word, be able to select the word, hit a the selected "key" and have the word capitalize.

Any advice or suggestions will be appreciated.

Many thanks in advance.
Peter
User avatar
Sir Teddy the First
Posts: 94
Joined: 05 Aug 2019, 12:31
Contact:

Re: Capitalize first letter of word where cursor at

06 Oct 2019, 10:33

Hi,
like this one?

Code: Select all

#SingleInstance Force

^#::
Clipboard := ""
Send +^{Right}
Send ^c
ClipWait

StringUpper Clipboard, Clipboard, T
Send ^v

return
You can replace "^#" with the hotkey you want to press.
In order to use this script you have to place the cursor in front of the word and hit the hotkey. The Script will automatically select the word and capitalize it.

I hope this is what you were looking for.
:eh: :think:
User avatar
boiler
Posts: 6631
Joined: 21 Dec 2014, 02:44

Re: Capitalize first letter of word where cursor at

06 Oct 2019, 10:37

Another version where you can click anywhere on the word you want to capitalize before you press \:

Code: Select all

\::
	ClipSave := Clipboard
	Clipboard := ""
	Send, {Ctrl down}{Left}{Shift down}{Right}{Ctrl up}{Shift up}
	Send, {Ctrl down}c{Ctrl up}
	ClipWait, 0.5
	StringUpper, Clipboard, Clipboard, T
	Send, {Ctrl down}v{Ctrl up}
	Clipboard := ClipSave
return
(also preserves clipboard contents)

Return to “Ask For Help”

Who is online

Users browsing this forum: AHKStudent, Bing [Bot], HiSoKa, Lord-9621 and 47 guests