Skip to content
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

Modifying an AHK version to track time spent in any app #1

Open
HuanNV9 opened this issue Apr 7, 2023 · 7 comments
Open

Modifying an AHK version to track time spent in any app #1

HuanNV9 opened this issue Apr 7, 2023 · 7 comments

Comments

@HuanNV9
Copy link

HuanNV9 commented Apr 7, 2023

Hello, the mobile version works for any app and has two timers:
A timer that counts the time spent in the current session (displayed at the top)
A timer that counts the time spent in the day (displayed at the bottom)
These timers are always visible and work for any app.
However, the AHK version, as I understand it, only works with the PDF reader. How can I modify it to function like the mobile version and work with any app?
I am also experiencing a font error as shown in the image below.

font error

@RustingSword
Copy link
Owner

Sorry I'm not sure what you mean by mobile version? As for the AHK script, you can add corresponding code like WinActive("ahk_class classFoxitReader") (change classFoxitReader to the class of your preferred application) to record time spent on that application.

Please make sure you are not using any non-ascii characters in the script to see whether there's still garbled text.

@ooker777
Copy link

after those time I'm surprised that you can still remember what the code does

@RustingSword
Copy link
Owner

It's only a few lines of code after all :-)
I find that it still works greatly for passive time tracking, and I'm considering to find something similar for Linux/macOS since I'm not using Windows anymore.

@ooker777
Copy link

ooker777 commented May 4, 2023

I guess python?

@RustingSword
Copy link
Owner

Yes, python would be my first choice. After some quick search and gpt chatting, it seems straightforward to get active window name/title, but a bit tricky to get urls from browser without installing some extensions. Anyways, It's definitely doable, and I will try to hack something out.

@HuanNV9
Copy link
Author

HuanNV9 commented May 4, 2023

Hi,
I'm really sorry for the delayed response. Somehow, I missed your message earlier.
Regarding the mobile app, I was referring to a Tasker app created by Ooker777. You can find more information about it on this Reddit thread:
https://www.reddit.com/r/tasker/comments/bbw8zx/share_corner_timer_displaying_app_usage_in_screen/
You're right that I can use a class to record the time spent on applications, but I think it's too broad as there are many apps with the same class. What I really want to do is track the time spent on every application on my PC, just like the mobile version does.
As for the font error, I wasn't able to identify the problem. I didn't make any modifications to your code, but the font error still persists. I'm not sure if it's related to my PC's font settings or not.

@RustingSword
Copy link
Owner

I see, then you can change If (WinActive(...)) to WinGet. More specifically, use WinGet, OutVar, ProcessName, A to save the process name of the active window in variable OurVar, and store time usage by each application in the log file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants