Facility Control

 View Only
  • 1.  Setting GPI Trigger ID

    Posted 06-20-2019 16:20

    Is there a way to set the GPI Trigger ID of a button similar to renaming or resizing it?

    ogscript.rename (Component ID, Name);

    ogscript.reposition (ID, x position, y position);

    ogscript.setSize (ID, width, height);

    ogscript.setStyle (Component ID, Style);

    Hoping for something like ogscript.setGPI (Component ID, GPI);

    Essentially wanting to change the GPI Trigger ID on a button based off a change in another parameter.

    Thanks!



  • 2.  RE: Setting GPI Trigger ID

    Posted 06-20-2019 19:53

    Hi Cole.

    While there is not a mechanism to programmatically-add a trigger ID to an existing button, you can programmatically-add trigger IDs to arbitrary ogScript function calls with ogscript.addRemoteTrigger('TRIGGER_ID', 'TRIGGER_NAME', TRIGGER_FUNCTION);

     

    Each time a trigger is added, an object is returned that contains a 'close' function. If you call the 'close' function, the added trigger will be deleted.

    For example

    function triggerFunction(event)
    {
    ogscript.debug('EVENT FIRED: ' + event.getTrigger());
    }

    var added = new Array();
    for (var i = 0; i < 2000; i++)
    {
    added.push(ogscript.addRemoteTrigger('Trigger ' + (i + 1), 'Number ' + (i + 1), triggerFunction));
    }

    ogscript.putObject('script-gpi', added);

     

    And, to remove them (optionally):

    var obj = ogscript.getObject('script-gpi');
    if (obj != null)
    {
    for (var i = 0; i < obj.length; i++)
    {
    obj[i].close();
    }
    }

     


    #DashBoard