Page 1 of 1

".PropertyName" in GetPropertyValue and SetPropert

Posted: Sun Jul 15, 2007 11:09 am
by jkish
If you could reference the underlying device implicitly from a script, then you could have reusable scripts for script devices. Currently (I think), all property reference from within a script must specifically reference a device/property pair. This forces a script to be associated with single device. If you could use ".property" to access the device associated with a script, then scripts could be used for multiple devices. This has the benefit of only having to fix bugs or add enhancements in a single place.

For example, I'm working on a ListManager script device. I would like to be able to create multiple ListManagers to work on various lists concurrently. If I had the above capability, I could create ListManager1, ListManager2, etc and they could all point to the same script. Today, I have to create a copy of the script and modify the script for each device and then when I have changes, I have to go back to each copy of the script and change it in the same way.

Posted: Sun Jul 15, 2007 2:50 pm
by Richard Naninck
You could work this around by putting your property name and value in another NULL device propertie and have another control change this propertie as you seem fit.

Example:

SetPropertyValue GetPropertyValue("NULLDevice.PropertyAndValue"), Data

Just tested this exact line and it works.
Still a workaround though!

Posted: Sun Jul 15, 2007 3:15 pm
by jkish
I've done the same thing you suggested to be able to point dynamically to different data.

Unfortunately, I don't think that gets around the problem of having to change the script if you want to make more than one script device of the same type - you still have to hard code the name of the NULLDevice that will contain the data into the script. It end up being only one thing to change, but you still end up with multipe copies of the script that you have to fix up.