Is there a way for a script to monitor the clipboard? I want to paste the clipboard to another application. When the contents of the clipbaord changes Ie select and copy, I want to paste to the app again.
If the data is always text and is less than 256 bytes long, you could use the cliptostr command to copy the clipboard to a string and then compare that string to a previous value you retrieved. If the strings are identical, then the data has not changed, but if they are different you know you have updated data in the clipboard. If the expected data is greater than 256 bytes, you could use the cliptofile command to save the data to a file, then read in that data chunk by chunk to determine if you have new data.
Here's a test script I wrote that uses cliptostr to get the clipboard data every five seconds. Then when sClip command will call the NewClip procedure whenever the data on the clipboard has been changed.
string sClip
proc main
when sClip call NewClip
while 1
cliptostr sClip
pause 5
endwhile
endproc
proc NewClip
usermsg "Clipboard now contains %s" sClip
endproc
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.