Jump to content
Sign in to follow this  
nobbe

take screenshots of multiple Webpages

Recommended Posts

nobbe

hi

as always there is still room for improvements - but for a first start im quite pleased with the results..

nobbe

CODE
;

; do screenshots of websites, save in scriptdir

;

; - please close all "internet explorer" sessions before snapshot

; - after new IE window starts, move IE to position where it is not overlapped by another window

; - press GO button

; author nobbe 2008

;

#include <GUIConstants.au3>

#include <IE.au3>

#include <String.au3>

#include <ScreenCapture.au3>

; -------------------------------------------------------------------

Global $oIE

; -------------------------------------------------------------------

$Form1 = GUICreate("screenshot demo", 200, 100, 0, 0)

$btn_go = GUICtrlCreateButton("go", 10, 10, 75, 20)

GUISetState(@SW_SHOW)

; ---------------------------------------------------------------------------------

$oIE = _IECreate("about:blank", 0)

; ---------------------------------------------------------------------------------

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

; start

Case $btn_go

doit()

Case $GUI_EVENT_CLOSE

Exit

EndSwitch

WEnd

; ---------------------------------------------------------------------------------

;

; do some screenshots

;

Func doit()

do_screen_shot_url("http://www.autoitscript.com")

do_screen_shot_url("http://www.google.com")

do_screen_shot_url("http://www.cnn.com")

;; or load from setup file etc..

EndFunc ;==>doit

;

; move to url, then take snapshot of IE window

;

Func do_screen_shot_url($url)

local $Hwnd, $Winlist, $list

Local $tmp = StringReplace($url, "http://", "");

Local $outfile = @ScriptDir & "\" & $tmp & "_1.jpg";

_IENavigate($oIE, $url)

_IELoadWait($oIE)

$Winlist = WinList()

For $list = 1 To $Winlist[0][0]

$WinTitle = $Winlist[$list][0]

If StringInStr($WinTitle, "Internet explorer") > 0 Then

$Hwnd = $Winlist[$list][1]

EndIf

Next

_ScreenCapture_CaptureWnd($outfile, $Hwnd)

sleep(500)

EndFunc ;==>do_screen_shot_url

Share this post


Link to post
Share on other sites
myspacee

Hello nobbe,

nice try !

i made some 'experiments' with this and with ScreenCapture.au3 inc in these days.

I can't go forward 'cause is impossible to snap graphics 'outside' border of windows resolution

(black screen is returned)

I research another method to snap webpages after try 'abdution!' pluging for firefox.

Little pluging with impressive result.

I think that Autoit is limited by windows in its snap 'gear'

thank you for script !

m.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×