unit property containing list?
ard jonker
ard.jonker at xs4all.nl
Sun Oct 13 07:50:35 EDT 2013
Hello Listas,
Xtension her has a few pseudo units set properties in a series of other units.
The ON script for e..g. the kitchen motion detector is
set ToUnits to {"light kitchen", "fumehood", "boiler"}
setproperties(((thisUnit)), ToUnits, 1)
where setproperties is
on setproperties(FromUnit, TheUnits, theValue)
if class of TheUnits is list then
repeat with aUnit in TheUnits
setproperties(FromUnit, aUnit, theValue)
end repeat
else
Set Unit Property FromUnit in unit TheUnits to theValue
end if
end setproperties
I noticed that the ON and OFF scripts need to use the same ToUnits list.
Manually keeping the list equal in the ON and OFF script is error prone.
I'd rather store them once in a (text) unit property and then by command of something like
set myList to ((Get unit Property "alist" from unit (thisUnit)) as list)
set them for the setproperties() script.
How does one store a {"item1","item2","item3"} list in a unit property?
I've tried the above and also
set myList to (Get unit Property "alist" from unit (thisUnit))
but both get me the error message
OSAError -1708: "alist" doesn’t understand the Get Unit Property message.
Any hints? Any much smarter ways of solving this?
Cheers,
Ard
More information about the XTensionList
mailing list