(view source code of snagtest.vbs as plain text)
Option ExplicitDim objSnagit, strMsg, wshShell' Check command line arguments (none required)If WScript.Arguments.Count > 0 Then Syntax
' Capture input typeConst siiDesktop = 0
Const siiWindow = 1
Const siiRegion = 4
Const siiGraphicFile = 6
Const siiClipboard = 7
Const siiDOSScreen = 8
Const siiMenu = 9
Const siiObject = 10
Const siiProgramFile = 11
Const siiFreehand = 12
Const siiEllipse = 13
Const siiRoundedRect = 14
Const siiTriangle = 15
Const siiPolygon = 16
Const siiWallpaper = 17
Const siiCustomScroll = 18
Const siiTWAIN = 19
Const siiDirectX = 20
Const siiExtendedWindow = 23
' Window selection methodConst swsmInteractive = 0
Const swsmActive = 1
Const swsmHandle = 2
Const swsmPoint = 3
' Capture output typeConst sioPrinter = 1
Const sioFile = 2
Const sioClipboard = 4
Const sioMail = 8
Const sioFTP = 32
' Output image typeConst siftBMP = 0
Const siftPCX = 1
Const siftTIFF = 2
Const siftJPEG = 3
Const siftGIF = 4
Const siftPNG = 5
Const siftTGA = 6
' Output color depthConst sicdAuto = 0
Const sicd1Bit = 1
Const sicd2Bit = 2
Const sicd3Bit = 3
Const sicd4Bit = 4
Const sicd5Bit = 5
Const sicd6Bit = 6
Const sicd7Bit = 7
Const sicd8Bit = 8
Const sicd16Bit = 16
Const sicd24Bit = 24
Const sicd32Bit = 32
' Output file naming methodConst sofnmPrompt = 0
Const sofnmFixed = 1
Const sofnmAuto = 2
' Create the required objectsSet objSnagit = CreateObject( "SNAGIT.ImageCapture.1" )
Set wshShell = CreateObject( "WScript.Shell" )
' Set input optionsobjSnagit.Input = siiDesktop
objSnagit.IncludeCursor = True
' Set output optionsobjSnagit.Output = sioFile
objSnagit.OutputImageFile.FileType = siftPNG
objSnagit.OutputImageFile.ColorDepth = sicd32Bit
objSnagit.OutputImageFile.FileNamingMethod = sofnmFixed
objSnagit.OutputImageFile.Filename = "snagtest"
objSnagit.OutputImageFile.Directory = "C:\"
' CaptureobjSnagit.Capture
' Launch the captured image in the default viewerwshShell.Run "C:\snagtest.png", 0, False
' Release the objectsSet objSnagit = Nothing
Set wshShell = Nothing
Sub Syntax strMsg = vbCrLf _& WScript.ScriptName & ", Version 1.01" _
& vbCrLf _& "Automate a SnagIt full screen capture" _
& vbCrLf & vbCrLf _
& "Usage: " & UCase( WScript.ScriptName ) _
& vbCrLf & vbCrLf _
& "Notes: [1] The resulting screenshot is saved as C:\snagtest.png." _
& vbCrLf _& " An existing file will be overwritten." _
& vbCrLf _& " [2] This script requires SnagIt to be installed on the local computer." _
& vbCrLf _& " SnagIt is commercial screen capture software by TechSmith." _
& vbCrLf _& " A 30-day trial version is available for download:" _
& vbCrLf _& " http://www.techsmith.com/screen-capture.asp" _
& vbCrLf & vbCrLf _
& "Written by Rob van der Woude" _
& vbCrLf _& "http://www.robvanderwoude.com"
WScript.Echo strMsg
WScript.Quit 1
End Sub
page last modified: 2025-10-11; loaded in 0.0086 seconds