[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

how to copy data to clipboard

Li Chen

10/10/2008 1:30:00 PM

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
--
Posted via http://www.ruby-....

1 Answer

Alex Fenton

10/10/2008 1:55:00 PM

0

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