-
-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Verbose setting isn't working #30
Comments
@vaxinc As written in the README.md,
On my machine, for example, it taskes almost 6 seconds to print the verbose tasklist. const tasklist = require("tasklist");
(async () => {
console.time();
console.log(await tasklist({ verbose: true }));
console.timeEnd();
})();
|
i see, apologize for the inconvience. Apparently i either have a slow machine or too many tasks open Is there a way to optimize this? Like only look for tasks with a certain imagename? |
`(async () => { })();` Something like this perhaps, dont know why the code markup wont work |
@vaxinc What's your use-case? Maybe I'm able to help if I know your requirements. |
An electronjs application that uses genius.com's api to retrieve lyrics for the current playing spotify song. I've developed this exact same app through pygame, so i know the procedure to it. The thing about spotify is that whenever you are playing a song, the windowTitle will change to the song name, so therefore the most efficient way to get the current playing song on spotify would be to look for the spotify.exe task and retrieve it's title. I'll look into fastlist though, thanks |
How about?
e.g. const child_process = require("child_process");
function current_spotify_song() {
return new Promise(resolve => {
child_process.execFile("powershell.exe", [ "-c", "get-process -name spotify | where { $_.mainwindowtitle } | select -expand mainwindowtitle" ], (err, stderr) => {
if (err) {
// No permission to execute powershell
return resolve(null);
}
let song = stderr.trim();
if (!song.includes(" - ")) {
// Spotify is open but there's no song playing
return resolve(null);
}
resolve(song);
});
});
}
(async () => {
console.log(await current_spotify_song());
})(); |
Actually, on second thought, const tasklist = require("tasklist");
(async () => {
let spotify_tasks = await tasklist({ verbose: true, filter: ["imagename eq spotify.exe"] });
console.log(spotify_tasks);
})(); Does this have acceptable performance on your machine? |
YES! very much, under 500ms! Thank you man |
Glad this worked for you. :) |
This work
(async () => { console.log(await tasklist()); })();
This doesn't
(async () => { console.log(await tasklist({verbose: true})); })();
No errors, just nothing. It seems as if the async function assigned to this task, completely stop working or is just running in a loop that cant be resolved. Is there something im missing, like some setting tweaking i need to do beforehand, or something completely different?
The text was updated successfully, but these errors were encountered: