mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-12 22:36:10 +08:00
* Merge updates (#4) * Merge upstream updates (#5) * Initial commit for MS OFfice Automation * Modified activex-excel and tests; activex-msforms * ADODB tests, DAO tests * msforms, msxml, mshtml * MSXML tests * Office, VBIDE, Word * Word * Word * Outlook, Powerpoint * Added project URL for stdole * Added 'private' to package.json * activex-adodb fixes * remove public member-access * activex-adodb fixes * activex-adodb tests fixes * activex-adodb-tests fix * activex-adodb-tests fix -- no-unnecessary-generics * remove public modifier * TravisCI fixes * More TravisCI fixes * More TravisCI fixes
23 lines
714 B
TypeScript
23 lines
714 B
TypeScript
/// <reference types="activex-word" />
|
|
|
|
const collectionToArray = <T>(col: any) => {
|
|
const results: T[] = [];
|
|
const enumerator = new Enumerator<T>(col);
|
|
enumerator.moveFirst();
|
|
while (!enumerator.atEnd()) {
|
|
results.push(enumerator.item());
|
|
}
|
|
return results;
|
|
};
|
|
|
|
const app = new ActiveXObject('Word.Application');
|
|
const projects = collectionToArray<VBIDE.VBProject>(app.VBE.VBProjects);
|
|
projects.forEach(project => {
|
|
WScript.Echo(`Name: ${project.Name}`);
|
|
|
|
collectionToArray<VBIDE.Reference>(project.References)
|
|
.forEach(reference => {
|
|
WScript.Echo(` ${reference.Name} ${reference.Major}.${reference.Minor} -- ${reference.FullPath}`);
|
|
});
|
|
});
|