URL Access Scripting - does it work?

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)

Hi, Kevin.

I’ve never used URL Access Scripting, so I can’t be much help here. I tried your download script on my Jaguar machine and it launched Classic for some reason. And still didn’t work. :confused:

One thing I did notice in the dictionary is that the parameter for ‘replacing’ is ‘yes’ or ‘no’, not a boolean. So in theory:

set theURL to "ftp://upload.comcast.net/~nitewing98/fly1.jpg"
set theFile to choose file name with prompt "Save file where?" as Unicode text
tell application "URL Access Scripting"
	launch
	download theURL to theFile replacing yes with authentication
end tell

I see you’re using OS 10.2.x. The latest version is of course 10.4.6, which has URL Access Scripting 1.1. It may have been fixed in the intervening years, but since my Tiger machine isn’t connected to the Net, I’m afraid I can’t test this fully for you. When I run the download script in Tiger, I’m offered an authentication dialog: ‘Connect to “upload.comcast.net” as:’, with name and password fields.

Nigel,

Yes, I see that (“replacing yes”). I tried so many combinations that I messed that up. But it still doesn’t work. Now I get the same “extension failure” error message for downloading that I got for uploading. :confused: I originally took that message to mean there was a failure in using the file type, but wonder now if it really means “The scripting extension failed.”

I read that on some systems if you had the classic/os 9 scripting stuff and classic mode was loaded that it would sometimes launch Classic. There is a way around that, I’ll find it and re-post later.

Thanks for trying. But your post confirms what I’m finding, that it may not work at all on Jaguar.

It does work in Tiger. Try this script on for size:

set newFile to (choose file name with prompt "Where should I download to?")
tell application "URL Access Scripting"
	activate
	download "http://www.slashdot.org/" to newFile replacing yes with progress
	quit
end tell

You may be missing authentication information in order to upload. That authentication info has to be included in your URL string, as in: “ftp://user:password@ftp.site.com/~user/”. That may work around your problem. URLAS doesn’t give very verbose error messages.

Alternately, include “with authentication” for your upload/download, and it will prompt every time you run for your information (you can also store it on the keychain for easy access). That saves you the security headache of having a hard-coded password in your script. Example:

set theFile to (choose file with prompt "What file should I upload?")
tell application "URL Access Scripting"
	activate
	upload theFile to "ftp://ftp.site.com/" replacing yes with progress and authentication
	quit
end tell

I used to use URL Access Scripting quite frequently, but eventually gave up due to its many limitations. I can do quite a bit more with the shell command curl, or if I want full on applescriptability, I tend to stick to Interarchy, which is quite capable of uploading and downloading to nearly any kind of server. The only time I’ll use URLAS is when I want to package something up to give to somebody else (like a drag & drop uploader or something).

Whoops, I got carried away in my attempts to be helpful. Obviously you know about authentication. Nevertheless, you script, with minor modifications, executes in Tiger.

set theURL to "ftp://ftp.ftpsite.com/file.html"
set theFile to choose file name with prompt "Save file where?"
tell application "URL Access Scripting"
	download theURL to theFile replacing yes with authentication and progress
end tell

Hi Kevin,

Just to verify. URLAS upload and download to ftp does work as I remember, but some of the parameters don’t work in osx. It’s better to use curl although I don’t know how.

gl,

My thanks to everyone who replied. As of this writing neither script works and I’m of the opinion (unsupported by fact) that the “extension failure” message is meant to indicate that there is a failure in the osax itself.

In short, as we used to say on the tech support desk when asked what was wrong with a particular caller’s computer or software: “Broke, don’t work.” Meaning, no cause found, no obvious reason for the failure, just obvious that it failed. :stuck_out_tongue:

If anyone who is using Jaguar (a minority, I realize) has any ideas or actually gets these scripts to work on their system, please post back here.

Hi Kevin,

I was planning to make a new site at my new isp. I’ll post a script that works in Jaguar. The problem with URLAS is that it is limited and it’s a fact that some parameters don’t work. I think the directory listing doesn’t work either although it has been a while since I used URLAS. Hope this isp has ftp.

Later,

Hi Kevin,

I can’t figure out how to make a web site at hawaiiantel.net. Every thing is going downhill. I can assure you that I have uploaded files with URLAS to ftp in the past.

Good luck,

Hmmm, I’m using 10.4.4 and I get the same extension faliure error. Bummer.
:frowning:

Everything I have heard regarding URL Access has said that:

a) it’s there for compatibility with OS 9
b) don’t use it
c) use “do shell script” and curl to achieve that same ends.

I’ve not had time to play with curl yet, so I guess I’m at a stand-still on this topic until such time as I can fool with curl.