Skip to content

Instantly share code, notes, and snippets.

@errorseven
Created August 27, 2016 18:44
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save errorseven/210868f848ff9bcc720c9858f9fd0868 to your computer and use it in GitHub Desktop.
Save errorseven/210868f848ff9bcc720c9858f9fd0868 to your computer and use it in GitHub Desktop.
Clipboard Queue - Keep multiple clipboards at the ready or paste them in a sequential order!
/*
___ _ _ ____
/ __\ (_)_ __ /___ \_ _ ___ _ _ ___
/ / | | | '_ \ // / / | | |/ _ \ | | |/ _ \
/ /___| | | |_) / \_/ /| |_| | __/ |_| | __/
\____/|_|_| .__/\___,_\ \__,_|\___|\__,_|\___|
|_|coded by errorseven @ 8/26/2016
Usage:
Ctrl + V Pastes based on Mode and contents of your ClipQueue
Ctrl + < Move Queue Pointer Left
Ctrl + > Move Queue Pointer Right
Ctrl + Alt + M Select used with Pointer, Queue Pops 1st Element Queue.
Ctrl + Alt + X Clear ClipQueue
*/
clipQueue := [], p := 1
clipPrevious := ""
Mode := "Select"
setTimer, checkClipboard, 100
$^v::
setTimer, checkClipboard, Off
if (Mode == "Select")
clipboard := clipQueue[p]
else if (Mode == "Queue") && (clipQueue.length())
clipboard := clipQueue.removeAt(1)
send, {Ctrl down}v{Ctrl Up}
clipboard := clipPrevious
setTimer, checkClipboard, On
return
^!m::
Mode := Mode == "Select"
? "Queue"
: "Select"
TrayTip, Mode, % "Set to " Mode,,500
return
^!x::clipQueue := []
^,::
p := p > 1 ? p - 1 : clipQueue.MaxIndex()
tooltip, % clipQueue[p]
SetTimer, RemoveToolTip, 500
return
^.::
p := p < clipQueue.MaxIndex() ? p + 1 : 1
tooltip, % clipQueue[p]
SetTimer, RemoveToolTip, 500
return
checkClipboard:
if (clipboard != clipPrevious) {
clipQueue.push(clipboard)
clipPrevious := clipboard
p := clipQueue.maxindex()
}
return
RemoveToolTip:
SetTimer, RemoveToolTip, Off
ToolTip
return
@GitTom
Copy link

GitTom commented Mar 1, 2019

It appears to me that the checkClipboard timer will run every 100ms, always (not just when invoking this script). Not knowing much about AHK I accept that this could well be necessary, but it is unfortunate. Am I reading it wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment