Skip to content

Instantly share code, notes, and snippets.

@ideadapt
Last active December 11, 2015 16:38
Show Gist options
  • Save ideadapt/4628604 to your computer and use it in GitHub Desktop.
Save ideadapt/4628604 to your computer and use it in GitHub Desktop.
set theStartingValue to "6710" -- this is the year to get data for
set theEndingValue to "7777" -- this is now the beginning date
set outputFolder to POSIX path of (choose folder) -- the folder to save the output files to
repeat with theIncrementValue from theStartingValue to theEndingValue by 1
set theURL to "http://polentajam.ch/Bildergallerie/galleries/PJam10-2012/IMG_" & theIncrementValue & ".jpg"
try -- skip errors
-- log "/usr/bin/curl " & theURL & " -o " & quoted form of (outputFolder & theIncrementValue & ".txt")
set fileVar to quoted form of (outputFolder & theIncrementValue & ".jpg")
do shell script "/usr/bin/curl " & theURL & " -o " & fileVar
do shell script "if ! identify " & fileVar & " &> /dev/null; then rm " & fileVar & "; fi"
on error errmess number errnum
if (errnum is -128) or (errnum is -1711) then error errmess number errnum -- pass it on (cancel)
log errmess
end try
end repeat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment