I’ve been scripting for a good number of years, and I cannot, for the life of me, get URL access scripting to work for me. Now, maybe it’s a peculiarity of my broadband’s ftp server, but I doubt it, as I have no trouble with Interarchy or using the command line ftp.
I have tried, without success, to
a) upload a file
b) download a file
c) download a directory listing
Nothing seems to work. Oh, wait, the directory listing tries to work, in that it creates a directory with nothing in it.
I’m posting two short scripts and if anyone can a) find what I’m doing wrong or b) tell me what trick got it to work for them, I’ll buy them a (virtual) steak dinner.
And please, I’ve already sifted through all the previous posts and through the applescript-users list at Apple. I know some people are using “do shell script” and curl or other solutions. While I appreciate that they have found work-arounds, I’m more interested in getting a definitive answer on whether the “URL Access Scripting” extension actually functions as Apple advertised it.
Cuz if it doesn’t, we need to get Apple to fix it.
Here’s the upload script:
set myFile to choose file with prompt "Select file to upload"
set myURL to "ftp://upload.comcast.net/"
tell application "URL Access Scripting"
upload myFile to myURL replacing yes with authentication and progress
end tell
display dialog "Done uploading " & name of myFile
which returns;
URL Access Scripting got an error: Extension failure
and here’s the download script:
set theURL to "ftp://upload.comcast.net/~nitewing98/fly1.jpg"
set theFile to choose file name with prompt "Save file where?"
tell application "URL Access Scripting"
download theURL to theFile with authentication and replacing
end tell
which returns:
URL Access Scripting got an error: Some data was the wrong type.
Model: iMac DV+ (450mhz), 384mb, 40gb HD
AppleScript: 1.9.1
Browser: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.1) Gecko/20060214 Camino/1.0
Operating System: Mac OS X (10.2.x)