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


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.

The Type informs you about the type of device or connection. 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.

The Phidgets IR Code Table Settings

click to enlargeEach learned IR code is displayed in this dialog with its Alias and the code word.
You can change the Alias, but it needs to be unique within the selected Code Table.

Use the Delete button to remove the code word from this table.

The scripting field can be filled with commands that should be executed when this code is received.
You can also use the offered Parameters as local variables, e.g. to indicate from where the command was triggered: Label1.Text = alias + " command issued from: " + deviceName

If you need to, you can also determine, whether this code can be only Sent or only Received.
Unchecking the Receive box for example will prevent the script from being executed when the code is received.
Press Apply to confirm your settings.

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:

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:

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

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:

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 {



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