node-process-windows
node-process-windows copied to clipboard
getActiveWindow Dont work
var processWindows = require("node-process-windows");
processWindows.getActiveWindow((err, processInfo) => {
if (err) console.log(err)
console.log("Active window title: " + processInfo.mainWindowTitle);
});
Dont log anything
Reading into the code, I found out this method does nothing, even though it's demoed in the Readme.
function getActiveWindow(callback) {
callback = callback || noop;
if (!isWindows) {
callback("Non-windows platforms are currently not supported");
}
}
It never executes the subprocess or calls callback(). All of the code to do this is pretty much there, and I think the creator might have just forgotten to commit the final version or something. Anyway, the last update was 2 years ago, so I'm making a fork to fix this.
If you want to fix the module yourself in the mean time, change the function to
function getActiveWindow(callback) {
executeProcess("--activewindow", callback)
}
And copy windows-console-app.exe
from node-process-windows/windows-console-app/windows-console-app/bin/Debug
to /bin/Release
. This is what makes me think this is a mistake, the fully built binary is in Debug, it just hasn't been copied to Release to implement the --activewindow
feature.