Created
February 22, 2010 17:39
-
-
Save sansumbrella/311286 to your computer and use it in GitHub Desktop.
Batch website screenshots using Safari
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(*_*) | |
(* Navigates to each page and takes a screenshot *) | |
(* Combined a screenshot script -- http://www.macosxhints.com/article.php?story=20030115080027106 -- with some javascript *) | |
set save_location to (choose folder with prompt "Choose where to save screenshots") | |
set base_url to "http://sansumbrella.com/writing/page/" | |
set first_page to 1 | |
set last_page to 5 | |
set filename to "screenshot-" | |
tell application "Safari" | |
activate | |
do JavaScript "window.resizeTo(1200, 824);" in document 0 | |
do JavaScript "window.moveTo(0,0);" in document 0 | |
end tell | |
repeat with id from first_page to last_page | |
tell application "Safari" | |
do JavaScript "window.location.href = '" & base_url & (id as string) & "/'" in document 0 | |
--let the page load | |
delay (4) | |
do shell script "screencapture " & quoted form of POSIX path of save_location & filename & (id as string) & ".png" | |
delay (1) | |
end tell | |
end repeat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment