HI,
I an looking to paste a screenshot to a file, I can do this with autoit < autoit.Send"{PRINTSCREEN}" />, but I am looking to append to a file?
Aidy
Used this, not sure of it's stability
require 'win32ole'
def take_a_screenshot
word=WIN32OLE.new('Word.Application')
autoit = WIN32OLE.new("AutoItX3.Control")
word.Documents.Add()
autoit.Send("{PRINTSCREEN}")
word.Selection.Paste
word.ActiveDocument.SaveAs('C:\screenshots.doc')
word.ActiveDocument.close
word.Quit
end
take_a_screenshot
Aidy
ps not tested, if it works I'll bang it on the wiki.
Aidy
-Devang
http://rubyforge.org/projects/win32screenshot/
Aidy
<code>
require 'watir'
require 'win32ole'
@@word=WIN32OLE.new('Word.Application')
@@word.Documents.Add()
def take_a_screenshot(url)
@autoit = WIN32OLE.new("AutoItX3.Control")
browser = Watir::IE.new
browser.bring_to_front
browser.goto(url)
browser.maximize
@autoit.Send("{PRINTSCREEN}")
browser.close
@@word.Selection.Paste
@autoit.Send("{ENTER}")
end
def save_file
@@word.ActiveDocument.SaveAs('C:\screenshots.doc')
@@word.ActiveDocument.close
@@word.Quit
end
take_a_screenshot('http://www.fsf.org/')
take_a_screenshot('http://www.pcs.org.uk')
save_file
</code>
Should it smarten it up and put it on th Wiki?
Aidy
Given up trying to log ino there can someone else put it up?
Aidy
No. Try to re-regoster and no email.
--
Sent from Google Mail for mobile | mobile.google.com