Last active
July 27, 2023 16:23
-
-
Save davebrny/9cb0c53fa049832ab46925f3597637c5 to your computer and use it in GitHub Desktop.
(autohotkey) - one line clipboard commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clipboard(string="") { | |
static clipboard_r | |
if (string = "/save") | |
clipboard_r := clipboardAll | |
else if (string = "/restore") | |
{ | |
clipboard := clipboard_r | |
clipboard_r := "" | |
} | |
else if (string = "/selected") | |
{ | |
clipboard := "" | |
send ^{c} | |
clipWait, 0.3 | |
return clipboard | |
} | |
else if (string = "/paste") | |
{ | |
send, ^{v} | |
sleep 100 | |
} | |
else if (string = "/clear") or (string = "") | |
clipboard := "" | |
else | |
clipboard := string ; set | |
} | |
/* | |
[script info] | |
version = 1.1 | |
description = one line clipboard commands | |
author = davebrny | |
source = https://gist.github.com/davebrny/9cb0c53fa049832ab46925f3597637c5 | |
*/ |
Author
davebrny
commented
Jan 24, 2017
examples:
clipboard("some text")
msgBox, % clipboard
clipboard("/save")
clipboard("/clear")
msgBox, % clipboard
clipboard("yolo")
msgBox, % clipboard
clipboard("") ; clear
msgBox, % clipboard
clipboard("more text")
clipboard("/restore") ; from /save
clipboard("/paste")
send {enter}abc{shift down}{left 3}{shift up}
selected := clipboard("/selected")
msgBox, % selected
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment