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