Copy only capital letters to the clipboard?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Shanghei
Posts: 28
Joined: 04 Jan 2021, 22:42

Copy only capital letters to the clipboard?

23 Apr 2021, 12:24

Hi guys, I was wondering if there was a way to only copy capital alphabet letters that are among randon numbers and symbols, maybe a regex match I am not sure?

For example 1@#11HxaaEllf%LLfffO if I highlight that and copy only HELLO will go to clipboard?

Thank you! I really appreciate the help.
User avatar
boiler
Posts: 17079
Joined: 21 Dec 2014, 02:44

Re: Copy only capital letters to the clipboard?

23 Apr 2021, 12:32

Run the script below and use Shift+Ctrl+C to copy only capital letters to the clipboard.

Code: Select all

+^c::
	Clipboard := ""
	Send, ^c
	ClipWait, 1
	if ErrorLevel
		return
	Clipboard := RegExReplace(Clipboard, "[^A-Z]")
return
Shanghei
Posts: 28
Joined: 04 Jan 2021, 22:42

Re: Copy only capital letters to the clipboard?

23 Apr 2021, 12:39

dang thats exactly what i needed, are you allowed to tip on this
Shanghei
Posts: 28
Joined: 04 Jan 2021, 22:42

Re: Copy only capital letters to the clipboard?

23 Apr 2021, 15:09

boiler wrote:
23 Apr 2021, 12:32
Run the script below and use Shift+Ctrl+C to copy only capital letters to the clipboard.

Code: Select all

+^c::
	Clipboard := ""
	Send, ^c
	ClipWait, 1
	if ErrorLevel
		return
	Clipboard := RegExReplace(Clipboard, "[^A-Z]")
return
Is there a way to modify this script so it copies either lowercasse or uppercase but ignores characters for instance H^e!L*O would copy hello?

Thanks again
User avatar
boiler
Posts: 17079
Joined: 21 Dec 2014, 02:44

Re: Copy only capital letters to the clipboard?

23 Apr 2021, 15:16

No tips necessary. Glad it’s helpful to you.
Shanghei
Posts: 28
Joined: 04 Jan 2021, 22:42

Re: Copy only capital letters to the clipboard?

23 Apr 2021, 15:25

boiler wrote:
23 Apr 2021, 15:16
No tips necessary. Glad it’s helpful to you.
It works great, one more thing, is there way to also include lowercase?
User avatar
boiler
Posts: 17079
Joined: 21 Dec 2014, 02:44

Re: Copy only capital letters to the clipboard?

23 Apr 2021, 15:26

Try this:

Code: Select all

+^c::
	Clipboard := ""
	Send, ^c
	ClipWait, 1
	if ErrorLevel
		return
	Clipboard := Format("{:L}", RegExReplace(Clipboard, "[^a-zA-Z]"))
	
return
User avatar
boiler
Posts: 17079
Joined: 21 Dec 2014, 02:44

Re: Copy only capital letters to the clipboard?

23 Apr 2021, 15:28

Your earlier post showed it making them all lowercase, so that’s what I did.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: GEOVAN and 175 guests