Page 1 of 1

Second Clipboard script solved

Posted: 19 Jan 2018, 15:19
by glogman
I finally managed to write a working script for a second clipboard.

Very basic but useful. It only worked once I decided to spam the ^c command. Still not totally sure why, but without spamming the copy command the script will spew up all kinds of errors and just not work correctly.

Do any of you have any idea why this works?
^g::

OldClip = %Clipboard%
Send, ^c
Send, ^c
Send, ^c
Send, ^c
Send, ^c
Send, ^c
Send, ^c
Send, ^c
Send, ^c
NewClip = %Clipboard%
Clipboard = %OldClip%

return

^h::
Clipboard = %NewClip%
Send, ^v
Clipboard = %OldClip%

return
I also had to "run as administrator." All in all a very long and weird search for what should have been a simple script.

Re: Second Clipboard script solved

Posted: 19 Jan 2018, 16:17
by Xtra
Take a look at: ClipWait
Clear the clipboard before sending ^c
Use ClipWait after sending ^c

HTH

Re: Second Clipboard script solved

Posted: 19 Jan 2018, 21:26
by BGM
What is a good time for clipwait?

I've had problems with clipboard, too. When I send ctrl+c, sometimes it just sends c - even to notepad.

Re: Second Clipboard script solved

Posted: 20 Jan 2018, 08:35
by derz00
Here's a revision of that. Check it out. Let me know what you think.

Code: Select all

^g::

OldClip := Clipboard, Clipboard := ""
Send, ^c
Clipwait
NewClip := Clipboard, Clipboard := OldClip

return

^h::
Clipboard:=NewClip
Send ^v
Clipboard:=OldClip
return