For example, you need to send the HEX string which contains volume level and part of this string is constant and the other part which represents the volume level changes from 0 to 100.

For example: $25,$50,$30,$31,xx  where хх is a required volume level from 0 to 100 (in HEX format).

Another example is the ASCII string 'VALUE хх' where хх is also a required volume level from 0 to 100 (in DEC).
These values should be sent from Levels or Editbox (not from separate Buttons). It can be implemented with the help of iRidium script

Example:

function Level_ASCII() {
var Packet = "VOLUME " + IR.GetItem("Page 1").GetItem("Item 6").Value + '\r\n';
IR.GetDevice("AV & Custom Systems (TCP)").Send([Packet]);
};

- this function is called Level_ASCII. It can be activated with the help of the command Script Call (Level_ASCII) in the Release event of the Level item.


If your command includes a ASCII string and you should send a Value in ASCII format (for example: 'SET LEVEL XX',$0A), use this script:

// -------- to send a Volume Value from the Level
var Msg = "SET LEVEL "; //This is the string with our command without volume value
var Packet;
IR.AddListener(IR.EVENT_ITEM_RELEASE,IR.GetItem("Page  1").GetItem("Item 1"),function() //This event will be active when you  release the level-button
{
  Packet = Msg+IR.GetVariable("Drivers.GC-100-12:Serial  1.Volume").toString()+'\n';   //Here we add the volume value to our  command
//IR.Log("Sended message = "+Packet)
  IR.GetDevice("GC-100-12:Serial 1").Send([Packet]); //here we send the result string to device
});

This commands takes the slider position at the moment of its release and writes VALUE xx \r\n inside the command and then send the complete command to the AV & Custom Systems (TCP) driver.

Forming commands in НЕХ works the same way but with the data converting from DEC to HEX. Please see the example.

ASCII-HEX.irpz

Is this article helpful for you?