GetDeviceRefByName

Purpose

This function returns the device reference for a device.  The device reference is different than an index to a device.  The device reference is only needed for other procedures which explicitly require the device reference.

Parameters

Parameter: sName
Type: string
Description: This is the device name including the location, such as "Family Room Lamp".

Returns

Return value: reference
Type: long
Description: This is a numerical device reference.

Example

Sub Main()
 

Dim dvRef
Dim dv

dvRef = hs.GetDeviceRefByName("Family Room Light")
if dvRef > 0 then
    Set dv = hs.GetDeviceByRef(dvRef)
else
    hs.WriteLog "Error","Could not find the reference for the device specified."
    exit Sub
end if

hs.WriteLog "Info","The address for the device is " & dv.hc & dv.dc

End Sub