Tonec.com Bringing Internet Technology Innovations to Market since 1991
  News Products Outsourcing About Us Contact Us
descriptiondescription what's new?what's new? featuresfeatures methodsmethods downloaddownload buybuy
  Tonec Homepage
ProductsWebSnapshotsamples

 WebPageSnapshot


Sample 1. simple.vbs


'Nov/15/05

'Declare object
Dim wss
'Create WebPageSnapshot object
Set wss = CreateObject("WebSnapshots.Snap.1")
'create snapshot
wss.GetWebPage 800,600, "http://www.cnn.com/"
'save the image at the specified format
wss.SaveAsPNG "C:\www.cnn.com.png"
'Clean the memory
wss.Clear
'delete the object
Set wss = Nothing

Sample 2 WebSnapshot 2.0 v15.vbs


'Nov/15/05

'''''The sample of using version 1.5 of the component
'''''----
'''''This sample shows the use of all methods of WebPageSnapShot v1.5 beta

'Nov/03/2003
'Declare objects and variables
Dim wss
Dim links

'Create WebPageSnapshot object
Set wss = CreateObject("WebSnapshots.Snap.1")

'Provide url
url = "http://www.microsoft.com"

'Provide file name without extension
file = "C:\microsoftv15"

'Set snapshot dimensions explicitly
'zero value of any parameter means maximum possible value of HTML document
width = 800
height = 600

'permit loading and running of ActiveX
wss.SetActiveX 1

'permit running Javascript and VBScript scripts
wss.SetScript 1

'permit using Java
wss.SetJava 1

'set timeout - it is used to force the termination of GetWebPage method.The
'incorrect termination causes memory leak in 'the version 1.5
'the value in msec
wss.SetTimeOut 30000

'set the type of navigation
'0 - load blank page first, then specified url
'1 - load the page at once, not recommended because of possible freezes
'1 - has an  advantage that images will not contain right scrollbar
'in the version 1.5 it is possible to set rectangle for snapshot using
'SetClipRectangle method.
wss.SetNavigationMode 0

'indicate that the images should also load
wss.ShowImage 1

' indicate that the data should be taken from cache if it is possible
wss.SetCacheMode 1

'add a cookie value to the existing one
wss.SetCookie "tonec=yes"

'v20
wss.SetRetrieveLink 1

'set a value for sending a form using POST method
'the blank value or not calling the method makes it possible to get a page
'using GET method
'in the case of using SetNavigationMode method with value 1, sending the
'form using POST method is impossible.
wss.SetForm "FNAME=test&SNAME=check"

'create snapshot
wss.GetWebPage width,height, url

'get real snapshot dimensions
'because of using zero values for height/width, arbitrary values
'are possible
newWidth  = wss.GetRealWidth
newHeight = wss.GetRealHeight

'set a rectangle for cutting a part of snapshot image
wss.SetClipRectangle 0,0,newWidth-17,newHeight

'set the dimensions of the final thumbnail
'if the method was not called we would receive the image with real dimensions
wss.SetThumbnailSize newWidth-17, newHeight

'save the image at the specified format
wss.SaveAsBMP file & ".bmp"
wss.SaveAsGIF file & ".gif"
'set the quality of jpeg image
wss.SetJpegQuality 100
wss.SaveAsJpeg file & ".jpeg", 100
wss.SaveAsPNG file & ".png"

'get info about a page. In the demo version the length of lines is limited.
title = "Title: " & wss.GetTitle
text = "Text: " & wss.GetText
links = wss.GetLinks
source = "Source: " & wss.GetSource
realUrl = "Real URL: " & wss.GetRealUrl
strMsg = title & vbCrLf & realUrl & vbCrLf & "w=" & newWidth & "  h=" &  newHeight

'get a link from the page. the demo version is limited to 3 links
if (isArray(links)) then
	for i = 0 to UBOUND(links)
		strMsg = strMsg & vbCrLf & i & " " & links(i)
	next
end if

MsgBox strMsg

'Clean the memory
wss.Clear

'delete the object
Set wss = Nothing

  TonecPrivacy Policy
  1999-2007. Tonec, Inc. All rights reserved.