You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to create a PR but I found no build scripts. In general my idea is that you can export a class like:
class COMIterator {
constructor(obj) {
this.obj = obj;
this.iter = this.obj._NewEnum;
}
[Symbol.iterator]() {
var localIter = this.iter;
return function*() {
if (localIter) {
var value = undefined;
do {
value = localIter.Next();
if (value !== undefined)
yield value;
} while(value !== undefined);
}
}();
}
}
and create a function Iter like
var Iter(obj) => new COMIterator(obj)
and then you can have code like:
var fso = ActiveXObject("Scripting.FileSystemObject");
console.log( "Read Drive Letter");
for(const dir of Iter(drives)) {
console.log( dir.DriveLetter);
}
Many COM objects use the _NewEnum mechanism to iterate. A Helper can be provided to make this easier.
The text was updated successfully, but these errors were encountered: