I have some code ( that someone else fixed for me - Im sorrry but I cant 
remmeber your name )
that probably does the same as win32::screenshot

I was intending to check it in in place of the nasty hack that uses the paint 
program

The problem was that it only saves bmp, but the default on the paint was jpg, 
and I wasnt keen on breaking existing stuff. And I was too busy to do it anyway 
;-)

But this code would be a good interim step if we didnt mind the default file 
type to be bmp

Paul
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 <[EMAIL PROTECTED]> 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
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general


_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to