How can I copy a string to Windows paste buffer.
A google search of
ruby "paste buffer"
seems not to have anything relevant.
Oh ... and is there a way to suck information out of the paste buffer in Ruby?
How can I copy a string to Windows paste buffer.
A google search of
ruby "paste buffer"
seems not to have anything relevant.
Oh ... and is there a way to suck information out of the paste buffer in Ruby?
If your using wxruby. I am not sure if the win32 integration has a method.
Most of the GUI Frameworks should have some way of accessing the clipboard.
Hope this helps.
Wx::Clipboard.open do | clip |
clip.data = Wx::TextDataObject.new("String data")
end
*
*
*
*
thanks,
--------------------------------------------------------------
Allan Davis
http://codesnakes.blogspot.com (my blog)
http://www.linkedin.com/in/javaalley
On Mon, Aug 9, 2010 at 12:23 PM, Ralph Shnelvar <ralphs@dos32.com> wrote:
How can I copy a string to Windows paste buffer.
A google search of
ruby "paste buffer"
seems not to have anything relevant.Oh ... and is there a way to suck information out of the paste buffer in
Ruby?
You might also look at win32-clipboard
http://rubyforge.org/docman/view.php/85/1694/README.html
On Mon, Aug 9, 2010 at 11:23 AM, Ralph Shnelvar <ralphs@dos32.com> wrote:
How can I copy a string to Windows paste buffer.
A google search of
ruby "paste buffer"
seems not to have anything relevant.Oh ... and is there a way to suck information out of the paste buffer in
Ruby?
Ralph Shnelvar wrote:
How can I copy a string to Windows paste buffer.
A google search of
ruby "paste buffer"
seems not to have anything relevant.
you could pipe it into the "nircmd.exe" program, as well...
--
Posted via http://www.ruby-forum.com/\.
Gordon,
Monday, August 9, 2010, 11:15:31 AM, you wrote:
How can I copy a string to Windows paste buffer.
A google search of
ruby "paste buffer"
seems not to have anything relevant.
Oh ... and is there a way to suck information out of the paste buffer in
Ruby?
You might also look at win32-clipboard
Gordon, may the blessings of all the gods of all religions fall upon your house and your family.
- - - -
To those who have trouble getting the example (full example below) to work, try adding
require 'rubygems'
before
require "win32/clipboard"
- - -
On Mon, Aug 9, 2010 at 11:23 AM, Ralph Shnelvar <ralphs@dos32.com> wrote:
##########################################################################
# clipboard_test.rb (win32-clipboard)
#
# Generic test script for those without Test::Unit installed, or for
# general futzing. You can run this example via the 'rake example' task.
##########################################################################
require 'rubygems' # Ad this to stop -- require "win32/clipboard" -- from complaining
require "win32/clipboard"
require "pp"
include Win32
puts "VERSION: " + Clipboard::VERSION
pp Clipboard.formats
pp Clipboard.data(Clipboard::UNICODETEXT)
pp Clipboard.format_available?(49161)
pp Clipboard.format_name(999999999)
pp Clipboard.format_available?(9999999)
puts "Data was: [" + Clipboard.data + "]"
Clipboard.set_data("foobar")
puts "Data is now: [" + Clipboard.data + "]"
puts "Number of available formats: " + Clipboard.num_formats.to_s
# Clipboard.empty
# puts "Clipboard emptied"