Basic OS X file pathname question...

In OS9 I used a script to update my web journal regularly. I would create the entry on my Clié, hotsync the file using Notetaker to my Mac, then hit a hotkey and watch my Mac hum and purr and update my website. Now that I have completely switched over to OSX, I am trying to update my applescripts to make my life all spiffy again. Problem is that I don’t understand how to access the same file from within OSX. Here’s a bit of the code:


set ploppy to file "Computer Name:Applications (Mac OS 9):Productivity:Palm:Users:My Name:NoteTaker:the.file.text"
try
	tell application "URL Access Scripting"
		upload ploppy to "ftp://xxx:xxxx@www.cootey.com/path stuff/" replacing yes with progress and authentication
		quit
	end tell
on error
	say "The upload failed.  The Splintered Mind has not been updated online." using "Boing"
end try

It worked wonderfully in 9, but OS X can’t find the file. I put a test file in my user directory and tried “Users:myname:file” and it couldn’t find that either. “Can’t get “Users:myname:file”” What am I doing wrong? Please help before I pull out all my hair.

:x

What happens if you change the above line to:

set ploppy to alias "Computer Name:Applications (Mac OS 9):Productivity:Palm:Users:My Name:NoteTaker:the.file.text"

Whenever I have problems that I suspect are path related, I use ‘choose file’ or ‘choose folder’ to get a proper path. As you move to OS X and begin to convert scripts, maybe it will be a useful debugging tool for you too. :slight_smile:

set ploppy to (choose file)

Thank you, Rob. That did the trick. Where can I learn about these changes from OS9 to OSX? Apple help isn’t very helpful… :stuck_out_tongue:

My next problem with the script is that it is loading Classic!! Argh! I did a search for “URL Scripting Additions” and there are two of them. One for OSX and one for OS9. NOW what am I doing wrong? I assume the problem is in the line:

	tell application "URL Access Scripting"

I looked over the dictionary for the OSX URLAS… and it appeared identical to the OS9 one.

To find out what’s changed, and what’s buggy, I usually turn to The AppleScript Sourcebook. Bill Cheeseman does an excellent job of documenting the various releases of AppleScript.

I have a OS X only setup so I’m probably not the best person to answer this question, but … If the script isn’t going to be distributed, you could just use a direct path to URLAS. Since it’s an app, and not a true osax, this might work:

tell application "My Computer:System:Library:ScriptingAdditions:URL Access Scripting.app:"
-- bla bla bla
end tell

If you need a more portable solution, we can do that too. :slight_smile:

I’ll check out the Applescript Sourcebook. I believe I have been there before, but had forgotten about it as a resource… :oops:

As for my script, your suggestion fixed the “launching Classic” problem. This begs the question “Why on earth is OSX calling an OS9 scripting addition!?!”

However, the script is STILL broken. It really worked snazzy in OS9. This has been frustrating. Now the script opens a dialog that prompts me for a password. This means that it is parsing the username I am using, but not the password. Once supplied, the app simply ends with an error.

set ploppy to alias "Computer:Users:me:Documents:Palm:Users:meagain:NoteTaker:file.text"
try
	tell application "Computer:System:Library:ScriptingAdditions:URL Access Scripting.app:"
		upload ploppy to "ftp://username:password@www.cootey.com/%2fhome/path/" replacing yes with progress and authentication
		quit
	end tell
on error
	say "The upload failed.  The Splintered Mind has not been updated online." using "Boing"
end try

First question is: How can I find out what is causing the error? Second question: Why isn’t my name and password being passed to the program? As I’ve stated before, this script worked just fine in OS9. Not knowing enough of how OS9 differs from OSX applescripting, I’m not sure where to begin…

The event log displays the following:

tell application "URL Access Scripting"
	upload alias "Computer:Users:me:Documents:Palm:Users:meagain:NoteTaker:file.text" to "ftp://username:password@www.cootey.com/%2fhome/darkstream/www/" replacing yes with progress and authentication
end tell
tell current application
	say "The upload failed.  The Splintered Mind has not been updated online." using "Boing"
end tell

I believe " and authentication" is calling up the dialog with the password prompt. This is behaving different from OS9, so removing it eliminated the authentication dialog, but the script still failed.
D

Not sure what the policy on this forum is on bumping, but since I’d like help solving this problem…

bump

To deal with errors, you can use something like:

try
	-- your statements
on error errMsg number errNum
	-- your error handler
	display dialog errMsg & return & errNum
end try

If you don’t want an error dialog, you could write the error info to a file.

Regarding URLAS, I can’t offer much but you might want to look into using the Keychain for authentication. I’ve never attempted it but I’ve heard that it can be done via AppleScript.

That was an interesting tip. We may be one step closer, but I’m still in the dark. It produced the result: “URL Access Scripting got an error: Disk some object is full. -34”

Where can I find out what that means!?!

LOL I feel so helpless here. ;/

This works for me:

set x to (choose file)
tell application "URL Access Scripting"
	upload x to "ftp://username:password@ftp.server.com/" replacing yes
end tell

Are you sure your FTP server is “ftp://www.cootey.com/”? Why don’t you try “ftp://ftp.cootey.com/” or “ftp://cootey.com”?

Neither of these are the problem. As I stated before, this script worked fine in OS 9 as it was typed at the top of this thread. ftp.cootey.com is a different directory than www.cootey.com. The address is correct as I typed it.

What I need to know is what is happening to the script and why it is failing. The error number is meaningless to me without some sort of key. This is very frustrating… I see no logical reason why this script is failing…

D

Does this fail only in “ftp://www.cootey.com/”? Many users have reported errors at AUL with UAS at some servers and bad internal character parsing… :?:
I’d take a look to shell scripting “curl” command.
More info: type “man curl” in a terminal window; and http://search.lists.apple.com/applescript-users?q=curl&m=all&o=0&wf=200010&wm=sub&ps=10