// tslint:disable-next-line no-unnecessary-generics const collectionToArray = (col: any): T[] => { const results: T[] = []; const enumerator = new Enumerator(col); enumerator.moveFirst(); while (!enumerator.atEnd()) { results.push(enumerator.item()); } return results; }; const app = new ActiveXObject('Word.Application'); const projects = collectionToArray(app.VBE.VBProjects); projects.forEach(project => { WScript.Echo(`Name: ${project.Name}`); collectionToArray(project.References) .forEach(reference => { WScript.Echo(` ${reference.Name} ${reference.Major}.${reference.Minor} -- ${reference.FullPath}`); }); });