Skip to content

Instantly share code, notes, and snippets.

@troutcolor
Last active September 9, 2023 10:19
Show Gist options
  • Save troutcolor/e76d56d3125b25a8e58a5992b523da57 to your computer and use it in GitHub Desktop.
Save troutcolor/e76d56d3125b25a8e58a5992b523da57 to your computer and use it in GitHub Desktop.
make a montage of screenshots from Safari tabs in top window. appleScript needs imageMagick & shot-scraper
--needs imageMagick & shot-scraper paths below refere to homebrew installs of both (guessing from the path)
--https://shot-scraper.datasette.io/en/stable/
set mytempFolder to do shell script "mktemp -d "
--just to watch things happening
do shell script "open " & mytempFolder
tell application "Safari"
set themax to number of tabs of window 1
set thelist to ""
repeat with x from 1 to themax
try
do shell script "cd " & mytempFolder & ";/opt/homebrew/bin/shot-scraper --quality 80 --wait 2000 " & URL of tab x of window 1 & " --width 1200 --height 800"
end try
end repeat
do shell script "cd " & mytempFolder & ";/opt/homebrew/bin/montage -mode concatenate *.jpg out.jpg || exit 0 "
end tell
set resultFile to POSIX path of (choose file name with prompt "Save As File" default name "links-montage.jpg" default location path to desktop) as text
do shell script "mv " & mytempFolder & "/out.jpg " & quoted form of resultFile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment