get an array of the item names that are on a popup or page

rocfusion 6 years ago in iRidium Script updated by Oksana (expert) 5 years ago 2

It would be useful when we could retrieve a list of item names for a page or popup. Knowing the names of the items contained in a popup would open up numerous possibilities of generating more generic control of the UI. This could be implemented as property of IR.GetPopup, for example;
var mypopupitems = IR.GetPopup("Popup 1").GetItemNames;

mypopupitems would be assigned an array of strings ( the names of the items ).

Please vote if you would like to see this implemented into the script....

Now as a workaround until we have a native solution, I have created the following.... which solves this for now. I hope this helps.

Array.prototype.GetItemNames= function(pageorpopup){
for(var y=0;y<pageorpopup.ItemsCount;y++){

IR.AddListener(IR.EVENT_START, 0, function() {

var myPopupItems= []; // create an empty array
myPopupItems.GetItemNames(IR.GetPopup("Popup 1"));
// retrieve an array of item names that are in Popup 1
IR.Log("first popup item names "+myPopupItems);
myPopupItems.GetItemNames(IR.GetPopup("Popup 2"));
// retrieve an array of item names that are in Popup 2
IR.Log("second popup item names "+myPopupItems);
// no need to empty the array the method will do this automatically