Phidgets - IR Code Table

Navigation:  Widget Designer > Devices > Phidgets >

Phidgets - IR Code Table

prev main next

Navigation:  Widget Designer > Devices > Phidgets >

Phidgets - IR Code Table

prev main next

Loading...

The Phidgets IR Code Table is a specialized Scripting object, similar to an Event Listener, to be used in combination with the PhidgetIR device.

A Code Table contains a selection of stored IR codes and allows managing these codes, as well as adding scripts to be triggered when a specific code is received.

Codes can be learned from a selected IR device and stored in a Code Table from the IRCode Manager.

Note that all Phidget devices are only available in the licensed Widget Designer edition, not the Free version.

Adding a New Phidgets IR Code Table

To add a Phidgets IR Code Table, open the Devices menu and select Phidgets > IR Code Table. This will open the Configuration dialog. Alternatively, you can add a new table in the Configuration dialog with the "+" button when the dialog is already open.

On the right side, you can name, dis-/enable the table or configure it as explained in the next paragraph.

WD_Phidgets_IR-Code-Table

The Type informs you about the type of device or connection. The Groups lists the groups to which this device belongs. The Name is the unique identifier for this Phidgets IR Code Table object in WD and the general rules for naming objects apply here as well: only letters, numbers and underscores are allowed; the first symbol must be a letter. It is possible to change the default name to a more descriptive one. When scripting, enter this Name to access available members or use the Project object and device Type instead; examples are shown further down.

The Id offers an alternative way to address the device when scripting.

The "Enable" check box is ticked per default. On the left side, you should see that the icon in front of your Phidgets IR Code Table is a filled blue circle, which means that the table is enabled. A filled gray circle indicates a disabled table.

You can close the dialog at any time. The newly created table will also be added to the Devices menu > Phidgets > IR Code Table and can be opened from here or with Devices menu > Configuration.

Using the IR Code Table in Regular Scripting

After adding a Phidgets IR Code Table, it can also be scripted which allows to perform actions on the Code Table object as well as retrieve information from it.

To use the table as scripting object, first create a CustomScript button or use the Macro editor or anything else with a scripting field. If you enter the table's identifier name into the script field (per default that is e.g. "Phidgets_IRCodeTable1") and Script Assist will offer a list of all available members.

An important member of this object is the Send method, which is used to send a code stored in this table with a specified Phidgets IR device's IR diodes:
Phidgets_IRCodeTable1.Send("Play","Phidgets_PhidgetIR1",10)

The Send and Receive check boxes can be ticked or unticked via scripting. This can be especially useful when the execution is supposed to be blocked due to a certain condition:
Phidgets_IRCodeTable1.DisableReceive("Play")

A complete list of all stored codes can be retrieved with the GetAliasNames member, for example to be displayed in a DropDownList:
var list = Phidgets_IRCodeTable1.GetAliasNames
DropDownList1.SetItemsFromArray("list")

The IR code word associated with a certain alias can be read out as well:
vstring = Phidgets_IRCodeTable1.IRCode("Play")

For a list with all available members and commands with examples and descriptions, please refer to the chapter Phidgets IR Code Table Members.

As an alternative to explicitly naming the device, the "Project" object can be used. Choose the device type and address the device by entering its ID or name. Script Assist then offers you the same list of members. This is the alternative for the first example from above:
Project.Phidgets_IRCodeTable(1).Send("Play","Phidgets_PhidgetIR1",10)

Substituting the ID with a dynamic variable allows automation. Actions can be performed on many connections of the same type simultaneously, e.g. by using for-loops:
For i = 1 to 10 {

 Project.Phidgets_IRCodeTable(i).Send("Phidgets_IRCodeTable1","Play",10)

}

The chapter "Project and Context Member" shows more examples with for-loops and if-clauses; of course, normal variables can also be used.