I'm trying to have 2 clipboards (or more), with an ahk script.
Desired behaviour is working with the standard ^v plus !v so it will be 2 clipboards. ^v being the usual one, !v will be the previous content that ^v had.
If I copy 'text1' on clipboard, I will have this as ^v. If I copy 'text2' I will have 'text2' on clipboard with ^v, plus the old 'text1' available with !v, and so on.
This is so far:
lastclip = %clipboard%
!v::
global lastclip
sendclip(lastclip)
return
ClipWaitChange()
ClipWaitChange()
{
While changed=0 {
global lastclip
lastclip = %clipboard%
Sleep 10
}
OnClipboardChange:
changed = 1
return
}
But it returns a blank clipboard or maybe ^v stops working.
Any hints how to do that?
sendclip is just a custom func to send the clipboard contents by keyboard
I tried put lastclip = %clipboard%
inside onclipboardchange but it copies the current changed clipboard, so has to be done before that.
While changed=0 {
? 2) Why create a waiting loop in the first place if you already have the handy "event"OnClipboardChange
? 3) You're talking about^v
which is CTRL+v. In your code, you defined!v
which is ALT+v. Which hotkey(s) are we talking about? Please describe exactly what you want to happen upon which event or user action and how you want to write to and read from 2 clipboards separately. – MCL