Trying to figure out how to use an object inside of a handler.
Granted, this particular example function is not saving that much code, but it'd still be nice to know how to access objects inside of them.
Let's say we want to toggle visibility of a particular layer of a placed object in our document. This would be within a TELL of a reference to the desired open document.
Assume we have:
An object - theObject - of a link in the document (such as a placed Illustrator file), which has layers.
A list - theList - containing 2 sub-lists of certain properties of every layer in the object. Sub-list 1=the id of each layer. Sub-list 2=the current visibility of each layer.
A number - theIndex - containing the desired index of the sub-list.
A boolean - theVisibility - representing the desired visibility.
Here's the handler (i.e., function):
# Function SetPlacedItemLayerVisibility
on fSetPlacedItemLayerVisibility(theObject, theList, theIndex, theVisibility)
if item theIndex of item 2 of theList is not theVisibility then
set current visibility of every graphic layer of graphic layer options of parent of theObject whose id is item theIndex of item 1 of theList to theVisibility
The applescript editor will not save this, giving the syntax error "A identifier can't go after this identifier". (Speaking of syntax errors, that should be "An", not "A".
Have tried making theObject a reference (either before, and inside the function), but that didn't help. The applescript editor still won't save, highlighting the "current visibility" portion of the above set statement with the above error.
Would someone be kind enough to post an example of how to accomplish this?