mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
27 lines
774 B
TypeScript
27 lines
774 B
TypeScript
/// <reference types="windows-script-host" />
|
|
/// <reference types="activex-word" />
|
|
|
|
const collectionToArray = <T>(col: { Item(key: any): T }): T[] => {
|
|
const results: T[] = [];
|
|
const enumerator = new Enumerator<T>(col);
|
|
enumerator.moveFirst();
|
|
while (!enumerator.atEnd()) {
|
|
results.push(enumerator.item());
|
|
enumerator.moveNext();
|
|
}
|
|
return results;
|
|
};
|
|
|
|
const app = new ActiveXObject('Word.Application');
|
|
app.Visible = true;
|
|
|
|
for (const project of collectionToArray(app.VBE.VBProjects)) {
|
|
WScript.Echo(`Name: ${project.Name}`);
|
|
|
|
for (const reference of collectionToArray(project.References)) {
|
|
WScript.Echo(` ${reference.Name} ${reference.Major}.${reference.Minor} -- ${reference.FullPath}`);
|
|
}
|
|
}
|
|
|
|
app.Quit();
|