how to copy data to clipboard

L

Li Chen

Hi all,

I want to send the word "copy" to the clipboard and trigger an event
like ctrl-c. which gem/library is used for this purpose?

Thanks,

Li
 
A

Alex Fenton

Li said:
Hi all,

I want to send the word "copy" to the clipboard and trigger an event
like ctrl-c. which gem/library is used for this purpose?

It depends what platform you're using.

For Win32 only, I'd expect you could use Win32API to do this, though
I've no idea what API call you'd need.

For OS X only, I'd look into Ruby-Cocoa or MacRuby. Again, I don't know
the specific API call needed.

For Linux/GTK only, try GTK-Ruby. Although GTK is meant to be somewhat
cross-platform, I remember reading somewhere that clipboard functions
don't work on Windows. This bug may be fixed now, however.

For a cross-platform solution, try one of the cross-platform toolkits,
either QT, FxRuby or wxRuby. With wxRuby, you would use the
Wx::Clipboard and Wx::TextDataObject classes.

a
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,059
Latest member
cryptoseoagencies

Latest Threads

Top