octalmage / active-window Goto Github PK
View Code? Open in Web Editor NEWGet active window title in Node.js.
Get active window title in Node.js.
This is the error I'm getting when running this in Electron on Windows 10:
D:\dev\becomethegamer\overlay\node_modules\active-window\index.js:42 Uncaught D:\dev\becomethegamer\overlay\node_modules\active-window\scripts\windows.ps1 : A positional parameter cannot be found
that accepts argument '1'.
(anonymous function) @ D:\dev\becomethegamer\overlay\node_modules\active-window\index.js:42emitOne @ events.js:90emit @ events.js:182readableAddChunk @ _stream_readable.js:153Readable.push @ _stream_readable.js:111onread @ net.js:531
D:\dev\becomethegamer\overlay\node_modules\active-window\index.js:42 Uncaught + CategoryInfo : InvalidArgument: (:) [windows.ps1], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : PositionalParameterNotFound,windows.ps1
(anonymous function) @ D:\dev\becomethegamer\overlay\node_modules\active-window\index.js:42emitOne @ events.js:90emit @ events.js:182readableAddChunk @ _stream_readable.js:153Readable.push @ _stream_readable.js:111onread @ net.js:531
D:\dev\becomethegamer\overlay\node_modules\active-window\index.js:42 Uncaught D:\dev\becomethegamer\overlay\node_modules\active-window\scripts\windows.ps1 : A positional parameter cannot be found
that accepts argument '1'.
+ CategoryInfo : InvalidArgument: (:) [windows.ps1], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : PositionalParameterNotFound,windows.ps1
I can provide any additional information you need.
Any suggestions?
I just tried on my Mac
System Version: OS X 10.11.5 (15F34)
Kernel Version: Darwin 15.5.0
I installed the module using npm install --save active-window
and tried to run example and got a minor error TypeError: monitor.getActiveWindow is not a function
I need to modify the example to use monitor(callback);
and it worked.
Just wondering if this could be used to get the title of any running app .. i.e. not necessarily the active window?
screenshot of console error: http://prntscr.com/odx8e1
When i try to run the example code multiple times, i get the above error on console. #
Noticed that the latest on NPM is 0.0.1 while this repo has 0.1.0 and the .getActiveWindow changes.
Thanks!
Trying to use this for an automatic time tracking app but noticed it doesn't seem to be able to detect changes in a browser tab. I assume because that's not a "window" - but is there a way to include this or is anyone aware of any other ways of getting this info?
Cheers
Heya! Love this -- though just a quick note -- the readme indicates a .getActiveWindow function while it actually exports the fn itself, didn't know if you wanted to update the readme with this or if the intent is to expose a getActiveWindow fn in the future, as well as other behavior (Rubs hands!)
Another one is that I use iTerm and I wigged for a second when OSx wanted me to grant accessibility rights to iTerm. but then I understood.
Thanks!
Powershell on windows with cyrillic locale uses koir8-r encoding. To fix this issue, just add
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
before Write-Host
in scripts/windows.ps1
The applescript used in this module doesn't seem to work properly.
When a window is opened then it reports the correct appName and windowTitle but when we minimise the current active window ( say chrome browser for instance ) then it keeps on reporting the appName and windowTitle for last active ( in this case Chrome ) Process only.
As this project seems abandoned, this is just a heads up for new users.
There are several old Pull Requests here that haven't even been reviewed (a couple of them are mine).
https://github.com/sindresorhus/active-win might be a quite better bet now.
It supports macOS, Linux and Windows. And it has several advantages (apart from being currently maintained). For example, it supports being used with Electron (this project would generate issues in several cases).
Disclaimer: I fixed the Linux implementation and added support for Windows.
Hey i've been giving this a good test and found it randomly crashes when switching windows. I can't seem to find a culprit it just appears to be random.
This is the error I see:
/usr/local/lib/node_modules/time-tracker/node_modules/active-window/index.js:42
throw stderr.toString();
^
/usr/local/lib/node_modules/time-tracker/node_modules/active-window/scripts/mac.scpt:314:319:
Hi, it doesn't work on macOS Mojave beta 10.14
Thrown: execution error: Not authorized to send Apple events to System Events. (-1743)
Hi ,
is it possible to capture data when windows file explorer is active? At the moment no data is being captured when file explorer is in focus (on my windows 10 pc)
I have a problem, I want to get now active window when i press some keys。so first i press key ,I can get the active window,but second press back throw stderr.toString();
this is my code :
`'use strict';
const ioHook = require('iohook');
const monitor = require('active-window');
ioHook.on("keydown", event => {
console.log(event);
/* You get object like this
{
type: 'mousemove',
x: 700,
y: 400
}
*/
if (event.keycode === 67 && event.rawcode === 120) {
monitor.getActiveWindow(() => {
try {
console.log("App: " + window.app);
console.log("Title: " + window.title);
}catch(err) {
console.log(err);
}
});
}
});
//Register and start hook
ioHook.start();
`
the errors :
throw stderr.toString();
Noticed that the latest on NPM is 0.0.1 while this repo has 0.1.0 and the .getActiveWindow changes.
Thanks!
setInterval(function() {
monitor.getActiveWindow(callback);
}, 1000);
// active-window/index.js
parameters = config.parameters;
parameters.push(repeats);
parameters.push(interval);
console.log(parameters); // overwrite configs...
const parameters = config.parameters.slice();
parameters.push(repeats);
parameters.push(interval);
End.
Hi,
I wondered if you have thought to upgrade the capabilities to access Top-N windows by z-index?
It could be great usability of your library.
Hi guys, I am using this module for a NodeJS/Electron/angular2 desktop application. Everything works good in the development mode but I don't understand why it doesn't work when I create a build/executable.
I have this error :
" ERROR uncaughtException: The argument 'C:\Users\loic\AppData\Local\Programs\my-app\resources\app.asar\node_modules\active-window\scripts\windows.ps1' to the -File parameter does not exist. Provide the path to an existing '.ps1' file as an argument to the -File parameter. "
Do you have any idea where it could come from ?
Thanks,
I am working on Windows 10
Hi....I am working at electron js...I want URL from browser.....
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.