Wiki Home

Snag It


Namespace: Wiki
Screen shot software. www.techsmith.com.

Unbelievable value. It captures windows, screens, areas, and can send them to clipboard, file, printer. It can convert graphical text to text. They now have a COM object that you can automate.

The following code demonstrates how to capture an image using the Snag It COM object. Note that this example previews the image - you can remove EnablePreview and provide a filename to capture directly to disk, but generally it seems like a better choice to let the user pick the destination and allow for image file type and save options through the Snag It UI.

Function CaptureImageWithSnagIt
LPARAMETER lcSaveDirectory
LOCAL oSnag as SnagIt.ImageCapture.1, lcFile

oSnag = CREATEOBJECT("SnagIt.ImageCapture.1")
oSnag.EnablePreviewWindow = .t.
oSnag.Input = 10 && Object
oSnag.Output= 2  && sioFile
oSnag.OutputImageFile.Filename = "captured_Image.png"
oSnag.OutputImageFile.FileType= 5  && siftPNG

IF !EMPTY(lcSaveDirectory)
  oSnag.OutputImageFile.Directory = lcSaveDirectory
ENDIF

oSnag.Capture()

*** Save Operation is Asynchronous (part of capture process)
DO WHILE .t.
   if oSnag.IsCaptureDone()
      EXIT
   ENDIF
   DOEVENTS
   WAIT WINDOW "" TIMEOUT .01
ENDDO

lcFile = LOWER(oSnag.LastFileWritten)
oSnag = .F.

IF EMPTY(lcFile)
   RETURN ""
ENDIF

RETURN lcFile


FWIW, for smallest image sizes Paint Shop Pro generally yields images that are 10% smaller in size than Snag It. They also provide a COM interface, but it's not nearly as useful.

-- Rick Strahl
Category Third Party Products
( Topic last updated: 2004.02.08 01:55:32 PM )