2nd Clipboard Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
MCcommand
Posts: 1
Joined: 20 Oct 2018, 12:21

2nd Clipboard

20 Oct 2018, 13:10

I need 5 extra clipboards, but for simplicity, lets say that I need 2.

Code: Select all

z::
;hold true clipboard
;copy selected text to a variable
;revert true clipboard
Return

x::
;hold true clipboard
;replace the clipboard with the saved one
;paste
;revert true clipboard
Return
I tried countless different methods but nothing worked. Please help me.
Thanks
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: 2nd Clipboard  Topic is solved

20 Oct 2018, 13:36

Try this. Ctrl+Win+Num to store text (and restore the clipboard). Ctrl+Num to paste text (and restore the clipboard). Cheers.

Code: Select all

^#1:: ;store selected text as variable
^#2::
^#3::
^#4::
^#5::
vNum := SubStr(A_ThisHotkey, StrLen(A_ThisHotkey))
ClipSaved := ClipboardAll
Clipboard := ""
SendInput, ^c
ClipWait, 3
if ErrorLevel
{
	MsgBox, % "error: failed to retrieve clipboard text"
	return
}
vClip%vNum% := Clipboard
Clipboard := ClipSaved
ClipSaved := ""
return

^1:: ;paste variable
^2::
^3::
^4::
^5::
vNum := SubStr(A_ThisHotkey, StrLen(A_ThisHotkey))
ClipSaved := ClipboardAll
Clipboard := vClip%vNum%
SendInput("{Shift Down}{Shift Up}{Ctrl Down}{vk56 Down}") ;vk56 sc02F
vWait := 3000
vStartTime := A_TickCount
Sleep, 100
while (DllCall("user32\GetOpenClipboardWindow", Ptr) && (A_TickCount-vStartTime < vWait))
	Sleep, 100
SendInput("{vk56 Up}{Ctrl Up}") ;vk56 sc02F
Clipboard := ClipSaved
ClipSaved := ""
return
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: fiendhunter, xask1 and 244 guests