User Tools

Site Tools


dictionary:unitinformation:enumeratedvalue

This is an old revision of the document!


Enumerated Value Of

The Enumerated Value Of verb returns a string equal to the enumerated value of a unit if available and in range or an apple script error if it is not. Examples of units that could be enumerated might be a thermostat mode unit which could be “off, heat, cool, auto” or a garage door unit that could be “open, closed”

In XTension the enumerations are stored as a comma delimited string in the enumerated values field of the display tab in the edit unit dialog. They are also used as the values for the popup menu if that is selected as the default control type to present for the unit.

In this example a thermostat mode unit is queried for it’s enumerated value and then reset via another enumerated value. This lets you not have to know that with this particular interface or thermostat off is 0 and heat is 1 and cool is 2.

if (enumerated value of “thermostat mode unit”) = “cool” then
  write log "mode is ac, changing to heat"
  set value of “thermostat mode unit” to "heat"
end if

History:

  • the enumerated value of verb was added in XTension version 9.4.36
dictionary/unitinformation/enumeratedvalue.1612379784.txt.gz · Last modified: 2023/02/13 14:51 (external edit)