Dumb Question

Why does this work


tell application "Finder"
	open folder "My_Disk:Test:"
	set parentFolder to "My_Disk:Test:"
	make new folder at parentFolder with properties {name:"Dummy"}
	set label index of (result as alias) to 2
end tell

and this doesn’t


tell application "Finder"
	open folder "My_Disk:Test:"
	set parentFolder to "My_Disk:Test:"
	make new folder at parentFolder with properties {name:"Dummy", label index:"2"}
end tell

The directory is created but the label is not set to “2” in the second script

Browser: Firefox 1.0.4
Operating System: Mac OS X (10.4)

I think it’s a bug, or a “not implemented feature” (this is common in OS X’s Finder, unfortunatelly).

This works in OS X 10.3.8:

tell application "Finder"
	open folder "My_Disk:Test:"
	set parentFolder to "My_Disk:Test:"
	set newFolder to make new folder at parentFolder with properties {name:"Dummy"}
	set label index of newFolder to 2
end tell

Two points: label index expects an integer, not text, so I removed the quotation marks around the number. This still didn’t work, so I split the assignment of properties into two operations, which did work (I have no idea why, but I’ve run into this sort of situation before).

Edit: Sorry I didn’t answer your real question; guess I was too busy reinventing the wheel… :confused:

Thank you. This confirms my conclusions with regard to Applescript; it lacks a coherent syntax. I have been slowly converting all my Applescripts to Perl and Perl/Unix commands.

This is a given for a language that has an extensible vocabulary and syntax created on a per application basis. To me it’s one of the challenges, but it’s not efficient. What amazes, is that Apple’s own applications are often the worst sinners for having a virtually opaque syntex: tell something to tell somethingelse, to tell… " or the necessity to search the entire keychain, i.e. list every… to get back one item, or extracting something from iCal.

Given that Apple’s claim to fame, as it were, is ease of use, and that this is achieved by standardization of tools, I’ve always been amazed that AS wasn’t brought into the fold by some clever means.