Jump to content


Photo

populate clipboard


  • Please log in to reply
2 replies to this topic

#1 jamestr

jamestr
  • Members
  • 98 posts

Posted 01 May 2004 - 11:11 PM

I trying to save the 'old' clipboard to oldclip.

To test this, I initially fill the clipboard with a rightclick/copy.

Then i select additional text and run the script

However %newclip% ends up null? any thoughts?

^c::
	oldclip = %clipboard%
	send, ^c
	newclip = %clipboard%
	send, %oldclip%
	send, %newclip%
return	



#2 Chris

Chris
  • Administrators
  • 10727 posts

Posted 02 May 2004 - 01:04 AM

There are two potential problems:

1) This hotkey "sends itself", so you should make it a hook hotkey to ensure it works correctly. Add a $ prefix.

2) Sometimes ^c needs a little time to take effect. The best way to script this is a revised version of yours:
$^c:: 
   oldclip = %clipboard%
   clipboard =  ; Must start off empty for detection to work.
   send, ^c
   ClipWait, 0.2
   if ErrorLevel <> 0  ; The wait timed out.
      return
   newclip = %clipboard% 
   send, %oldclip% 
   send, %newclip% 
return


#3 jamestr

jamestr
  • Members
  • 98 posts

Posted 02 May 2004 - 04:14 PM

Thanks for the script,


I wasnt aware that:

clipboard = ; Must start off empty for detection to work



James