Download problems

I have been working on a script to download some images from the internet. Today I seem to be getting some problems with the line:

tell application "URL Access Scripting" to download ImageLink to (DownloadFolder & FileName)

Intermittently I am getting the following Errors:

Does anyone have any ideas? This was working like a charm yesterday.

THIS IS REALLY ANNOYING! I run it without changing anything and 1 out of 3 times it is working without a problem. I know there should be a way to replace this URL access with curl but don’t really know how to do that. To make things worse I just tries again and it is working fine. Does anyone have a link to Apple’s documentation on URL access scripting or can someone help me understand how to do this with curl?

Here’s the basic curl syntax:

set webAddr to "http://www.google.com/intl/en_ALL/images/logo.gif"
set place to "/POSIX/Path/to/Folder/"
set fileName to "google.gif"
do shell script "curl -o " & place & fileName & " " & webAddr

Go into the terminal and type “man curl” for more information on how to set up the commands.

Thanks, I have read a number of posts using curl but could not make sense of all the “quoted form of” and “curl -a” and for such a small command there is a lot that can be done with it using all the variants (-a, -b, -o). Though I have been using AppleScript for over 10 years I admit that I am clueless on unix scripting though and could not make much sense of it, and defiantly not enough to combine it with AS and come up with a the proper syntax. Your 4 lines of code explain it very well.

On a side note it appears that the problems that my URL access line is coming from a connection problem since it works most of the time with the intermittent error creeping up mostly when I change the path of the download folder, the next time it runs it seems to clear the problem out and downloads correctly though with the odd file it will error out the second time as well. I will try a variant with curl and see if it clears the problem out.

Thanks again.
Jerome