".PropertyName" in GetPropertyValue and SetPropert

Have an idea for a new feature? Voice your opinion here.
Post Reply
jkish
Member
Posts: 29
Joined: Thu Jun 07, 2007 1:17 pm
Location: Roswell GA

".PropertyName" in GetPropertyValue and SetPropert

Post 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.
Richard Naninck
HouseBot Guru Extraordinaire
Posts: 1121
Joined: Tue Sep 28, 2004 7:49 am
Location: The Netherlands

Post 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!
jkish
Member
Posts: 29
Joined: Thu Jun 07, 2007 1:17 pm
Location: Roswell GA

Post 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.
Post Reply