+5
Voting
get an array of the item names that are on a popup or page
Hi,
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){
this.length=0;
for(var y=0;y<pageorpopup.ItemsCount;y++){
this.push(pageorpopup.GetItem(y).Name);
}
}
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
});
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){
this.length=0;
for(var y=0;y<pageorpopup.ItemsCount;y++){
this.push(pageorpopup.GetItem(y).Name);
}
}
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
});
0
Waiting for user's reply
Oksana (expert) 9 years ago
0
Voting
Oksana (expert) 9 years ago
Customer support service by UserEcho