Here is some source code that we use in Screenshot Sender. If it doesn't make sense let me know.
js code:
function EnumControls(File, pPlusWnd) {
_debug.getfuncname(arguments);
// Load the XML from the specified file
var XML = new ActiveXObject('MSXML.DOMDocument');
XML.load(File);
// Loop through all of the controls
var Controls = XML.selectNodes('/Interfaces/Window[@Id=\'' + pPlusWnd.WindowId + '\']/Controls/Control');
for (i=0; i<Controls.length; i ++) {
var Id = Controls[i].getAttribute('Id');
var Type = Controls[i].getAttribute('xsi:type');
// Controls starting with _ are options but not stired in the registry (ie Debug info is in the ScriptInfo.xml)
if (Id.charAt(0) !== '_') {
// Get the value depending on the control's type
objControls[Id] = {};
objControls[Id].XsiType = Type;
objControls[Id].Value = pPlusWnd_GetControlvalue(pPlusWnd, Id, Type);
}
}
}