[Wtr-general] saving screenshots with snagit
Charley Baker
charley.baker at gmail.com
Wed Jan 31 11:43:31 EST 2007
There are some sample programs using the com binding on Techsmith's website
and minimal COM api docs. You might also take a look at Aslak Hellesoy's
screenshot library for Ruby:
http://blog.aslakhellesoy.com/articles/2006/12/02/getting-screenshots-from-watir
-Charley
On 1/30/07, david goodine <davegoodine at gmail.com> wrote:
>
> Hello,
>
> I've found a couple posts that indicate that snagit's COM server can be
> used to capture screenshots while Watir runs tests.
>
> I've tried to implement something with this, but I am having trouble with
> the Autoscroll options. I have not been able to figure out how to set
> capture options except by using integers. However, I cannot find a
> reference for which integer corresponds to which option, so the process has
> been trial and error.
>
> What I have so far is below. When I view the resultant screen shots, they
> are not scrolled, so I cannot see the lower part of the web page:
>
> def screenCapture(client, environment, directory)
> # this method will use snagit to capture and save a screenshot to a
> directory
> require 'win32ole'
>
> # create snagit ole object:
> snagit = WIN32OLE.new('Snagit.ImageCapture')
>
> # set properties for the capture
> snagit.Input = 1 #capture a window
> snagit.Output = 2 #output to a file
> snagit.InputWindowOptions.SelectionMethod = 1 # select active window
> for capture
> # set the filename for the capture
> snagit.OutputImageFile.Filename =
> createScreenCaptureFilename("#{client}-#{environment}", directory)
> snagit.OutputImageFile.Directory = directory # set directy
> where filename will be saved
> snagit.OutputImageFile.FileNamingMethod = 1 # set naming method
> to fixed
> snagit.AutoScrollOptions.AutoScrollMethod = 0 # set autoscroll to
> vertical and horizontal
> snagit.OutputImageFile.ColorDepth = 5 # set color depth
> to 8 bits
>
> # do the capture
> snagit.Capture
>
> # verify that capture is done, then return
> while !snagit.IsCaptureDone
> if snagit.IsCaptureDone then
> return
> end
> end
>
> return
>
> end
>
>
> Does anyone have a reference for snagit that shows which integers
> correspond to which options?
>
> snagit version: 7.1
>
> thanks in advance for any comments,
> Dave
>
> _______________________________________________
> Wtr-general mailing list
> Wtr-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070131/55c69ee8/attachment.html
More information about the Wtr-general
mailing list