Second Clipboard script solved

Post your working scripts, libraries and tools for AHK v1.1 and older
glogman
Posts: 1
Joined: 19 Jan 2018, 15:07

Second Clipboard script solved

19 Jan 2018, 15:19

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.
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: Second Clipboard script solved

19 Jan 2018, 16:17

Take a look at: ClipWait
Clear the clipboard before sending ^c
Use ClipWait after sending ^c

HTH
User avatar
BGM
Posts: 507
Joined: 20 Nov 2013, 20:56
Contact:

Re: Second Clipboard script solved

19 Jan 2018, 21:26

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.
User avatar
derz00
Posts: 497
Joined: 02 Feb 2016, 17:54
Location: Middle of the round cube
Contact:

Re: Second Clipboard script solved

20 Jan 2018, 08:35

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
try it and see
...

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: Google [Bot], kaka2 and 77 guests