How do I Create a Custom Property

Björnke von Gierke bvg at mac.com
Wed Apr 21 07:48:21 EDT 2004


On Mittwoch, Apr 21, 2004, at 13:38 Europe/Zurich, David Burgun wrote:

> ...
>
> 2.  I need to create a Custom Property and set it to ValueX ONLY if it 
> doesn't already exist, if it does exist then I want it to be left 
> untouched.
>
> So for number 1, I just need to set the Custom Property, but for 
> number 2, how can I tell if the Custom Property exists?

An existing property returns a value. So you could ask for it like this:
get the MyCustomProp of this stack
if it = emtpy then //does not exist or is empty
end if

Of course this does not help when you have lots of empty properties 
that you want left untouched. Alternatively you could thus get the 
customKeys, and query if your property is already there:
get the customKeys of this stack
if MyCustomProp is not among the lines of it then // no such property
end if

> Also, what is the intended use of the "customKeys" and what does it 
> actually save in "myCustomKeys" after executing this line:
>
>   put the customKeys of this stack into myCustomKeys
>
> Specifically, does it return a list/array or a string or what? How Can 
> I appended to it and then set is back again using the following line:
>
>    set the customKeys of this stack to myCustomKeys

The customKeys is a list of items, delimited by lineendings. So if you 
want to append something you would do it like this:

put the customKeys of this stack into myCustomKeys
put return & "myNewCustomProp" after myCustomKeys
set the customKeys of this stacj to myCustomKeys



More information about the use-livecode mailing list