• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Url Access Scripting
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Url Access Scripting


  • Subject: Re: Url Access Scripting
  • From: Wayne Melrose <email@hidden>
  • Date: Wed, 29 Dec 2010 10:02:03 +0100


On 29. des. 2010, at 04.14, Carl Anderson wrote:


Does anyone know how to get AppleScript Editor's URL access scripting application to run?



Here's a version of using curl, I've made a small handler for it, and included the -f option which will force it to error, giving you some feedback, if you don't, then it will write out a small html file (even if you've named the output ".jpg")


I've also included a repeat to download the images within the URL you've provided as a sample, this will loop through 1 to 99 (just to make it simpler for me) and download anything that exists within that range .. 

set strSourceURLBase to "http://members.aceweb.com/randsautos/photogallery/ferrari/enzo/"
set strLocalBase to POSIX path of (path to desktop) & "ferrari/"

do shell script "mkdir -p " & strLocalBase

repeat with i from 1 to 99 -- assuming there are 100 or so images
set strImageName to "Ferrari-Enzo-0"
if i < 10 then
set strImageName to strImageName & "0" as string
end if


set strImageName to strImageName & i & ".jpg" as string
set strSourceURL to strSourceURLBase & strImageName as string
set strLocalDestination to strLocalBase & strImageName as string


try
curlDownload(strSourceURL, strLocalDestination)
on error errmsg
log errmsg
end try
end repeat


on curlDownload(strSourceURL, strLocalDestination)
try
set strQuotedURL to quoted form of strSourceURL
set strQuotedLocalDestination to quoted form of strLocalDestination


do shell script "curl -f " & strQuotedURL & " -o " & strQuotedLocalDestination
on error errmsg
error "curlDownload" & return & return & "There was an error trying to download the file, it is possible it does not exist" & return & return & "  ----------------------------------------" & return & return & strQuotedURL & return & return & "  ----------------------------------------" & return & return & errmsg
end try
end curlDownload
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Url Access Scripting
      • From: Christopher Stone <email@hidden>
References: 
 >Url Access Scripting (From: Carl Anderson <email@hidden>)
 >Re: Url Access Scripting (From: Wayne Melrose <email@hidden>)
 >Re: Url Access Scripting (From: Carl Anderson <email@hidden>)

  • Prev by Date: Re: Url Access Scripting
  • Next by Date: Re: Address Book scripting bug
  • Previous by thread: Re: Url Access Scripting
  • Next by thread: Re: Url Access Scripting
  • Index(es):
    • Date
    • Thread