Properties vs. Elements??

Hi…sorry for the basic nature of my question, but I am trying to better understand the hierarchy of Applescript so I can interpret the scripting dictionaries. I keep getting hung up on the difference between elements and properties. Can anyone offer a helpful interpretation? To me it seems like with some classes things are properties and when I would expect them to be properties they are actually elements. I’m sure there is a basic difference, but I don’t see it.

Thanks.

Elements are generally sub-items or substructures of the class whose dictionary entry you’re reading. Things like windows, files, folders, messages, text, etc. They may have elements of their own.

Properties are values that describe some aspect or situation regarding an item of that class: it’s size, colour, visibility, position, etc.

Some properties may look like elements because they represent things. In these cases, the “thing” isn’t usually a sub-item of the item in the dictionary. What’s represented is the information that the thing is associated in some way — such as the ‘original item’ of an alias file, or a folder associated with a window.

Hope this makes sense. :slight_smile:

Hi,

Also, with regards to heirarchy, you can look at it visually. An reference to an object might have the form:

element1 of element 2 of … of elementn of application appidentifier

where elementn has the form:

elementclass elementidentifier

some elementidentifiers might be numeric index, name, id, range, filter, etc.

On the other hand, if each of the elements above were say folders, then you can apply a property of class folder to each of those elements. eg. if name is a property of an element, then y ou can apply the name property to aeach of those elements:

name of element1 of element2 of … of elementn of application appidentifier
name of element2 of … of elementn of application appidentifier
name of elementn of application appidentifier

All these words may not mean much. You might want to just do AppleScript and then one day reading dictionaries might come like a bolt of lightning and you’ll slap your head and say “I got it!”. One of the main things are inheritance.

With Inheritance, you need to experiment because all properties of the parent might not apply.

The main difference is this. If you look above, the objects have identifiers. On the other hand, properties don’t have identifiers because they apply to all objects of a certain class. For instance, you don’t see such things as:

name 1 of folder “a” of folder “b” of app “Finder”

Properties don’t need the “1”, while if name where a class, then the “1” would be required.

gl,

Thanks Nigel and Kel. I appreciate the help. Kel, I have been working on this stuff and waiting for that “A ha!” moment for a while. :slight_smile:

Maybe this will be my year.

Hi,

You’re welcome. That element part where I used elements in paths is a bad analogy though. Had a little too much alchohol. Elements do have identifiers though and that is one of the main thing when looking at the dictionaries.

gl,