Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Script from Joshua Johnson's post on how to automate screencaps (https://mac.appstorm.net/general/applescript-automatically-create-screenshots-from-a-list-of-websites/)
--Variables
set whichUrl to 1
set fileNames to "webshot"
--Get Number of URLs
tell application "TextEdit"
set theCount to the count of paragraphs of front document
end tell
--Repeat this for every URL
repeat theCount times
--Get the next URL
tell application "TextEdit"
set currentUrl to paragraph whichUrl of front document as text
end tell
--Open the URL in Safari
tell application "Safari"
activate
set the URL of document 1 to currentUrl
--Wait until it loads, then take a screenshot
delay 5
set picPath to ((POSIX path of (path to desktop)) & fileNames & "-" & whichUrl & ".jpg") as string
do shell script "screencapture -tjpg " & quoted form of picPath
end tell
--Increase the counter for next time
set whichUrl to whichUrl + 1
end repeat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.