Copy Clipboard, how to?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
WetWorx
Posts: 6
Joined: Wed Mar 10, 2010 3:30 pm

Copy Clipboard, how to?

Post by WetWorx » Mon Mar 15, 2010 7:48 pm

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?

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Re: Copy Clipboard, how to?

Post by BvG » Mon Mar 15, 2010 8:07 pm

for example

Code: Select all

put the clipboarddata["text"] into myVar
replace "<" with "[" in myVar
set the clipboarddata["text" to myVar
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

WetWorx
Posts: 6
Joined: Wed Mar 10, 2010 3:30 pm

Re: Copy Clipboard, how to?

Post by WetWorx » Mon Mar 15, 2010 8:25 pm

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.

WetWorx
Posts: 6
Joined: Wed Mar 10, 2010 3:30 pm

Re: Copy Clipboard, how to?

Post by WetWorx » Mon Mar 15, 2010 8:34 pm

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?

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Re: Copy Clipboard, how to?

Post by BvG » Mon Mar 15, 2010 9:04 pm

Try the dictionary for these commands and terms.

Also: Yes it is that easy.
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

Klaus
Posts: 14193
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Copy Clipboard, how to?

Post by Klaus » Tue Mar 16, 2010 9:23 am

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

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Copy Clipboard, how to?

Post by sturgis » Tue Mar 16, 2010 8:43 pm

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

WetWorx
Posts: 6
Joined: Wed Mar 10, 2010 3:30 pm

Re: Copy Clipboard, how to?

Post by WetWorx » Tue Mar 16, 2010 9:40 pm

I added it and am moving along in my project with both of your help, thank you.

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Re: Copy Clipboard, how to?

Post by BvG » Wed Mar 17, 2010 1:23 pm

Oops, yeah definitely a typo, sorry for that :oops:
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

WetWorx
Posts: 6
Joined: Wed Mar 10, 2010 3:30 pm

Re: Copy Clipboard, how to?

Post by WetWorx » Wed Mar 17, 2010 4:47 pm

BvG, nothing at all to apologize for, you taught me something, I thank you for that.

Post Reply