I'm in the process of moving a library of objects with custom behaviors out of my application file and into a separate object library file so I can use from any other applications. The behavior filed of these objects all name buttons on a specific card in the original application and I need to change all the instances of these objects to name the equivalent buttons in my object library.
Is there some sort of Find command or any code I could write to do this? The find/replace command I see in the script editor only seems to look through scripts.
Thanks,
Pete
How to find references to a button in the behavior field
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: How to find references to a button in the behavior field
The behavior property of an object is a long id, so it contains an absolute reference to the behavior object. I'd rather it were otherwise, but that's what we've got. I think the best thing might be for you to group the child objects, then iterate over the objects in the group, setting the behavior of each one (untested):
repeat for each control tControl in group x
set the behavior of tControl to the long id of button b
end repeat
repeat for each control tControl in group x
set the behavior of tControl to the long id of button b
end repeat
Re: How to find references to a button in the behavior field
I guess there's something weird going on with my behavior definitions because they aren't a long ID - they all look like 'button 1234 of stack "xyz" - unless I'm misunderstanding what a long id is.
That's kind of a side issue though because I still need to change them all. Ideally, what I'd like to do is write a script that repeats for every stack, for every card in each stack, and for every control on each card to look for non-empty behaviors. I have almost all of that figured out except that I can't figure out how to either get a list of all the stack names in my stack file or repeat through them some how. There has to be a way to do that?
Pete
That's kind of a side issue though because I still need to change them all. Ideally, what I'd like to do is write a script that repeats for every stack, for every card in each stack, and for every control on each card to look for non-empty behaviors. I have almost all of that figured out except that I can't figure out how to either get a list of all the stack names in my stack file or repeat through them some how. There has to be a way to do that?
Pete
Re: How to find references to a button in the behavior field
put the substacks of this stack