====Unit Extract Record====
Most of the [[:dictionary:lists:|list verbs]] will return either just a list of names or an Extract Record. This contains most of the important data about the unit. They are AppleScript "Records" and the fields of information can be accessed by the name of the field like. Property names currently available in the Extract record are:\\
\\
* **xtName** (text, the name of the unit, just Name may also work)
* **xtValue** (number, the value of the unit, just Value may also work)
* **xtFlags** (number, individual bits of low level flags)
* **xtAddress** (text, the address of the unit, if any. will be empty for pseudo)
* **xtTimestamp** (date, last activity date for the unit)
* **xtDescription** (text, the description of the unit)
* **xtHasAddress** (boolean, will be false for a pseudo unit)
* **xtBlocked** (boolean, is the unit blocked)
* **xtGroup** (boolean, true if the unit is a group)
* **xtReversed** (boolean, true if the unit is reverse logic)
* **xtDImmable** (boolean, true if the unit is dimmable, also true for pseudos that can store numbers.
* **xtReceiveOnly** (boolean, true if unit is set to receive only)
* **xtSimPreset** (boolean, true if the unit dimming style is set to Simulated)
* **xtHardOff** (boolean, true if a dimmable unit has been sent a hard off as opposed to being dimmed to 0, can be used to predict the Nova effect.)
* **xtAnalog** (boolean, true if an analog unit)
* **xtSingleClick** (boolean, true if the checkbox for single click in view toggles is on)
* **xtSmart** (boolean, true if the dimming is set to Smart)
* **xtWireless** (boolean, true if the device type is wireless)
* **xtPassThrough** (boolean, **deprecated** only of use with legacy database format)
* **xtSecurity** (boolean, unit is an X10 security device)
* **xtInterface** (text, name of the interface to which the device is assigned)
* **xtCurrentLabel** (text, the label currently displayed by the unit)
* **xtDevice** (text, the name of the device as selected in the device popup, ie, x10 Powerline)
* **xtIgnoreClicks** (boolean, true if the unit should not be controllable from the list, keeps you from accidentally changing numbers you shouldn't)
\\
Once you have an extract record from any source you access it via these keys:
write log (xtName of MyUnitExtractRecord) & " is " & (xtCurrentLabel of MyUnitExtractRecord)
These all can also be accessed via an individual units applescript object model. So if you’re interested in checking to see if a single unit is blocked you can do something like this:
if xtBlocked of xUnit “my Unit Name” then
write log “The unit is blocked"
else
write log “the unit is NOT blocked"
end if
a particularly useful one is the xtCurrentLabel of xUnit “my unit name” which will return the currently applicable label “on” or “off” or “open” or “closed” or “alarm” or “clear” or whatever you have in those fields in the unit based on the current status with no further checking of values on your part.
Additionally further properties can be accessed through the xUnit class that are not included in the extract record.
* OnScript the On script of the unit as a script object
* OffScript the Off script of the unit as a script object
* xtOnLabel the text to display when the unit is ON
* xtOffLabel the text to display when the unit is OFF
* xtLastMemberTimestamp only valid if the unit is a group, returns the most recent timestamp of any units in the group. Useful to making sure that an interface is actually functioning or not.
* OnScriptText the plain text of the ON script (can be gotten or set)
* OffScriptText the plain text of the OFF script (can be gotten or set)
* xtID this is the unique ID of the unit as used internally by XTension.
* xtUnitOfMeasure the unit that will always be displayed after the value such as “˚F” for a temperature or something similar.