Stacking multiple copy operations example with replacing character

Share your favorite FastKeys commands
Post Reply
noticz
Posts: 5
Joined: Jun 3rd, ’25, 06:06

Post by noticz » Jun 4th, ’25, 18:30

I just wanted to share this code snippet, maybe it will help someone else out there that might need to do the same thing. I have this setup as a shortcut for ctrl + c as a command. It takes and checks if the second copy operation contains a certain text and then combines the first copy with the second copy and upon pasting will contain both clipboard strings formatted to your liking.

Example:
First copy - /msg [MG]-Gynoid xdcc send #127
Second copy - irc://irc.abjects.net/mgods
Paste results - xdcc://irc.abjects.net/mgods/ctcp [MG]-Gynoid xdcc send #127

Code: Select all

clipboardBefore=%clipboard%
Send, ^c
ClipWait 1
clipboard=%clipboard%
If InStr(clipboard, "irc://") {
	If InStr(clipboardBefore, " xdcc send ") {
		replace := "/msg "
		with := "/ctcp "
		StringReplace, clipboardBefore, clipboardBefore, %replace%, %with%, All
	}
	replace := "irc://"
	with := "xdcc://"
	StringReplace, clipboard, clipboard, %replace%, %with%
	clipboard = %clipboard%%clipboardBefore%
}
User avatar
Marko
Posts: 1924
Joined: Mar 2nd, ’13, 21:02

Post by Marko » Jun 4th, ’25, 21:47

Interesting, thanks for sharing.
Post Reply