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

Please wait. Due to its content this page might take a while to load...

The Phidgets IR Code Table is a specialized Scripting object, similar to an Event Listener, 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.

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 opens the Configuration dialog. Alternatively, you can add a new table in the Configuration dialog with the "+" button.

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

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 underscore are allowed, the first symbol must be a letter).
If you like, you can change the default name to a more descriptive one. When scripting, enter the name to access available members as described further down.

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. An empty 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, you can also use it via scripting 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"), Script Assist will offer you 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_Ir1",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:
DropDownList1.SetItemsFromArray(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 Members.