indexOf only works on String objects. There is no 'indexOf' in the params object.
In the code above, it looks like you may get better use out of using an INT parameter with an INT_CHOICE constraint. Then, the value of the parameter would be the same as the index of the selected item.
<abs contexttype="opengear" id="_top">
<meta>
<params>
<param access="1" constrainttype="INT_CHOICE" name="Clip IDs" oid="Clip_IDs" precision="0" type="INT32" value="3" widget="combo">
<constraint key="0">Clip 1</constraint>
<constraint key="1">Clip 2</constraint>
<constraint key="2">Clip 3</constraint>
<constraint key="3">Clip 4</constraint>
</param>
</params>
</meta>
<param expand="true" height="48" left="35" oid="Clip_IDs" top="41" width="318"/>
<button buttontype="push" height="56" left="357" name="Go" top="39" width="99">
<task tasktype="ogscript">ogscript.debug('SELECTED INDEX: ' + params.getValue('Clip_IDs', 0));</task>
</button>
</abs>
Otherwise, you could write a utility function to get the constraint (list of choices) and find out which one is selected:
<abs contexttype="opengear" id="_top">
<meta>
<params>
<param access="1" constrainttype="STRING_CHOICE" maxlength="-1" name="Clip IDs" oid="Clip_IDs" type="STRING" value="Clip 1" widget="combo">
<constraint>Clip 1</constraint>
<constraint>Clip 2</constraint>
<constraint>Clip 3</constraint>
<constraint>Clip 4</constraint>
</param>
</params>
</meta>
<param expand="true" height="48" left="35" oid="Clip_IDs" top="41" width="318"/>
<button buttontype="push" height="56" left="357" name="Go" top="39" width="99">
<task tasktype="ogscript">function indexOfSelection(oid)
{
var param = params.getParam(oid, 0);
var choices = param.getConstraint().getChoices();
var value = param.getValue();
for (var i = 0; i < choices.length; i++)
{
if (value == choices[i])
{
return i;
}
}
return -1;
}
ogscript.debug('SELECTED INDEX: ' + indexOfSelection('Clip_IDs'));</task>
</button>
</abs>
#DashBoard