How to copy data to clipboard

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

Li Chen wrote:

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