Page 1 of 1

Copy Clipboard, how to?

Posted: Mon Mar 15, 2010 7:48 pm
by WetWorx
I am trying to copy what ever is on the clipboard (mac) so that I can do a search and replace on it (I want to find any HTML and replace it with BBCode alternatives).

This is my first try, anyone have any ideas that could help me?

Re: Copy Clipboard, how to?

Posted: Mon Mar 15, 2010 8:07 pm
by BvG
for example

Code: Select all

put the clipboarddata["text"] into myVar
replace "<" with "[" in myVar
set the clipboarddata["text" to myVar

Re: Copy Clipboard, how to?

Posted: Mon Mar 15, 2010 8:25 pm
by WetWorx
Thank you for the fast response BvG, as I said, I am a complete n00b at RunRev programming, in your example, on the third line, there is no closing bracket around the 'text' variable, it's not throwing any errors, so I am assuming it is correct?

If you could show me how to display the resulting text, it might make things alot clearer for me.

Re: Copy Clipboard, how to?

Posted: Mon Mar 15, 2010 8:34 pm
by WetWorx
Wait a second, I put the code into a mouse handler on MouseUp, and then checked the contents of the clipboard, and it really worked, it can't be this easy, can it?

Re: Copy Clipboard, how to?

Posted: Mon Mar 15, 2010 9:04 pm
by BvG
Try the dictionary for these commands and terms.

Also: Yes it is that easy.

Re: Copy Clipboard, how to?

Posted: Tue Mar 16, 2010 9:23 am
by Klaus
WetWorx wrote:Wait a second, I put the code into a mouse handler on MouseUp, and then checked the contents of the clipboard, and it really worked, it can't be this easy, can it?
It can and it is, get used to it :D


Best

Klaus

Re: Copy Clipboard, how to?

Posted: Tue Mar 16, 2010 8:43 pm
by sturgis
WetWorx wrote:Thank you for the fast response BvG, as I said, I am a complete n00b at RunRev programming, in your example, on the third line, there is no closing bracket around the 'text' variable, it's not throwing any errors, so I am assuming it is correct?

If you could show me how to display the resulting text, it might make things alot clearer for me.
To be correct, the closing bracket in the line

Code: Select all

 set the clipboarddata["text" to myVar
Should indeed be there, so is a typo I'm sure. Surprised the code works without actually.

Corrected:

Code: Select all

set the clipboarddata["text"] to myVar

Re: Copy Clipboard, how to?

Posted: Tue Mar 16, 2010 9:40 pm
by WetWorx
I added it and am moving along in my project with both of your help, thank you.

Re: Copy Clipboard, how to?

Posted: Wed Mar 17, 2010 1:23 pm
by BvG
Oops, yeah definitely a typo, sorry for that :oops:

Re: Copy Clipboard, how to?

Posted: Wed Mar 17, 2010 4:47 pm
by WetWorx
BvG, nothing at all to apologize for, you taught me something, I thank you for that.