dgrace wrote:That's pretty easy to implement, but the DeviceList call into Windows is really expensive. I'm thinking that if you want to use it at all, you'll want the device names that it returns. I'd be worried about people calling it twice, once to get the number of items, and a second time to get the values, and then blaming me when their CPU spikes.
:P
dave
Well, it wouldn't work that way, since you can return both the list and the numeric count at once with the plugin. You simply have to return the list as the string value and the count as the number value of the plugin measure. So there is no need for two measures, they can just use [MeasureName] to get the string value, and [MeasureName:] to get the number value.
However, on balance I think you are right. The other issue is that as you see, it's not just the total count of devices, but then which number in that count the current device is, and that is both a while different kettle of fish and could be expensive indeed if they are not careful about how they do it, since the active device can be changed while the skin is running.
I think the Lua script(s) are simple enough, just make use of the single call to the device list one time, and can be restricted to running only once when the skin is refreshed or the active device actually changes. I also really think this is an "edge case" anyway, as that arbitrary number isn't really terribly relevant 99% of the time.