Page 1 of 1

Timer that counts up when pressing hotkey?  Topic is solved

Posted: 24 Jun 2018, 15:18
by StijnTV
The idea I have in mind is making a timer that counts up and when pressing a key it makes a quick note of that specific time. I would be using this while streaming so I can find my highlights back very easily without having to look back through the full video.

I have been looking around for hours now but I'm getting nowhere close unfortunately as I have no idea where to start. Pointing me in the right direction would be highly appreciated.

Timer that counts up and keypress gives me passed time

Posted: 24 Jun 2018, 15:36
by StijnTV
So what i want to do is create a timer that counts up. Whenever i press a hotkey it will then write down the time in a notepad (not the time as in AM or PM but the time that has passed since running the script).

Example: I'm a streamer on Twitch playing video games and i also record the gameplay. Whenever i do something sick i want to press a hotkey that writes down the time that has passed since i started the script (for example 10 minutes into the stream). This would tell me after the stream where i have to look to find this highlight (because i would start the script at the same time as the recording). It's basically a marker like you put in a book but for in a video.

I hope this makes sense. Feel free to ask more questions if necesarry.

post merged with duplicate post!

Re: Timer that counts up when pressing hotkey?

Posted: 25 Jun 2018, 02:13
by Rohwedder
Hallo,
try:

Code: Select all

q::
Gosub Logger ;write this line into each hotkey
Return

Logger:
	FileAppend, %A_TickCount%`t%A_ThisHotkey%`n, Logger.txt
Return

Re: Timer that counts up when pressing hotkey?

Posted: 25 Jun 2018, 03:12
by Xtra

Code: Select all

#NoEnv

0::FileAppend, % RunTimer() "`n", Logger.txt    ; Press 0 to log time

RunTimer() {
    static s := A_TickCount
    VarSetCapacity(t,256),DllCall("GetDurationFormat","uint",2048,"uint",0,"ptr",0,"int64",(A_TickCount-s)*10000,"wstr","h':'mm':'ss","wstr",t,"int",256)
    return t
}
HTH