Setting properties of an object with a record?

Does AppleScript have the ability to set the properties of an object with a record? e.g.,

set properties of my_object to {name: "New Name", color: "Red", size: 12}

If so, what might it be?

Thanks!
Colin.

Hi,

Yes you can set properties of objects with records. I think you’ll get errors if you try to set read only properties and I don’t think all objects have the ‘properties’ property. The Finder is easy. Here’s an example on a folder:

tell application “Finder”
activate
set new_folder to (make new folder at desktop with properties {name:“hi”}) as alias
delay 1
set info_window to (open information window of new_folder)
delay 2
set current panel of info_window to Comments panel
delay 3
set properties of new_folder to {name:“bye”, comment:“I’m back!”}
end tell

gl,

Hmmm… Unfortunately this seems to crash my Finder.

I’m actually trying to set the properties of an iTunes track and have tried the syntax you used with the Finder but it doesn’t seem to be acceptable to iTunes.

So I guess it just can’t be done. I was hoping I just had the phrasing wrong.

Thanks anyway,
Colin.

Hi,

It probably crashed because the delays weren’t long enough for your computer. Maybe your reference to the track was not correct. I’ll try an iTunes properties thing when I get back from work unless someone else posts.

gl,

I tried with iTunes and seems it doesn’t work.
Whether support for get/set groups of properties is supported may depend on the application. Finder does support it. Apparently iTunes doesn’t, though it defines “properties” as a collection of properties for an object. So, though something is defined in a dictionary, it is not mandatory true.