One Works & One Doesn't...

OK, I fixed my own problem…

But I still have to know – why does the first script work and the second one doestn’t?

Here’s the first script:

And here is the script that doesn’t work:

Thanks in advance,
Tom

[These scripts were automatically tagged for color coded syntax by Convert Script to Markup Code]

It looks like there is some terminology conflict. The “path to” command comes from Standard Addtions, and the Finder doesn’t seem to like it:


tell application "Finder"
	path to desktop --> error "Finder got an error: Can't make desktop into a item."
end tell

However, the “path to” command isn’t needed when your inside a Finder tell statement:


tell application "Finder"
	desktop folder --> this is the Finder's terminolgy
end tell

Thanks! That helps a lot…

This also works – I guess it wants desktop folder, instead of desktop…

–Tom


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

I find it’s better to check if the folder exists first to see if there is a conflict as opposed to waiting for the Finder to tell me there’s a conflict. In some versions of Mac OS, it will create an untitled folder and then try to rename it leaving you with unwanted folders. this solves that by switching the order of operations:

Oh, as it says in the Finder dictionary, I always use “at” instead of “in” for making new items. I didn’t even know “in” would work.

Jon


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

Thanks for the tip!

Did you ever get the feeling that AppleScript is like the martial arts? You must continue to learn, grasshopper – unless you are Matt Neuberg, or Paul Berkowitz, or a couple of other people…

I can hear it now, “Matt Neuberg is the Bruce Lee of AppleScript!”

–Tom