Page 1 of 2
Delete Custom Property
Posted: Tue Jul 29, 2014 10:13 pm
by Da_Elf
How do i go about removing a custom property
ive tried setting it to empty, setting it to false, using delete and using remove
Re: Delete Custom Property
Posted: Tue Jul 29, 2014 10:27 pm
by [-hh]
..........
Re: Delete Custom Property
Posted: Tue Jul 29, 2014 10:35 pm
by Da_Elf
i dont get it. a custom property isnt a variable
if i type
Code: Select all
on mouseUp
set the cMyProperty of the stack "myMainStack" to "something"
end mouseUp
then it will create a custom property in that stack called cMyProperty which can be called like
Code: Select all
answer the cMyProperty of the stack "myMainStack"
if i wanted to cleanup the custom properties im looking to delete some of them
Re: Delete Custom Property
Posted: Tue Jul 29, 2014 10:53 pm
by magice
Re: Delete Custom Property
Posted: Tue Jul 29, 2014 10:56 pm
by [-hh]
..........
Re: Delete Custom Property
Posted: Tue Jul 29, 2014 11:14 pm
by Da_Elf
the code
Code: Select all
set the customKeys of this stack to empty
will totally clear out all of the customProperties i want to just remove 1 of them. It has to be done via script so doing it through the inspector is not an option
Re: Delete Custom Property
Posted: Tue Jul 29, 2014 11:34 pm
by jmburnod
Hi,
Try this
Code: Select all
on delprop pVar
put the customkeys of this stack into myArray
delete variable MyArray[pVar]
set the customproperties of this stack to myArray
end delprop
Best
Jean-Marc
Re: Delete Custom Property
Posted: Wed Jul 30, 2014 12:23 am
by [-hh]
..........
Re: Delete Custom Property
Posted: Wed Jul 30, 2014 12:35 am
by Da_Elf
is that to be run as a command or function?
never mind it worked like a dream
Re: Delete Custom Property
Posted: Wed Jul 30, 2014 12:43 am
by [-hh]
..........
Re: Delete Custom Property
Posted: Fri Aug 01, 2014 9:24 am
by Mark
Hi,
Jean-Marc's approach doesn't use offset and should therefore be much faster if you want to delete a large range of custom properties.
For the record, if you want to delete a key from a nested property, you don't need to use the customProperties property:
put the cProp of me into myPropArray
delete variable myPropArray["x"]
set the cProp of to myPropArray
but if you want to delete the property itself, here cProp, then you'll need the customProperties property.
Kind regards,
Mark
Mark
Re: Delete Custom Property
Posted: Fri Aug 01, 2014 5:18 pm
by [-hh]
..........
Re: Delete Custom Property
Posted: Fri Aug 01, 2014 5:22 pm
by Mark
Hermann,
What do you mean with not-deleted?
Mark
Re: Delete Custom Property
Posted: Fri Aug 01, 2014 5:33 pm
by [-hh]
..........
Re: Delete Custom Property
Posted: Fri Aug 08, 2014 11:02 pm
by Da_Elf
supposed when i want to alter the custom properties of an item i want to delete all of the properties then store the new ones. however if something is wrong with the new ones to store i want to halt whats going on... then put the original properties back in. i can put te properties back in by using set customKeys of me to cks but how can i get a full array of the customkeys of the property and its value to save then put it back in (hope that made sense)
example of what i mean if i have some customKeys set with values in ButtonA and this script is run when ButtonB is clicked
Code: Select all
on mouseUp
put the customkeys of button "ButtonA" into cks
set the customKeys of the button "ButtonA" to empty
answer "keep properties? " with "Yes" or "No" titled "Delete properties"
if it = "Yes" then
set customKeys of button "ButtonA" to cks
end if
end mouseUp