Timer that counts up when pressing hotkey? Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
StijnTV

Timer that counts up when pressing hotkey?  Topic is solved

Post by StijnTV » 24 Jun 2018, 15:18

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.
StijnTV

Timer that counts up and keypress gives me passed time

Post by StijnTV » 24 Jun 2018, 15:36

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!
Rohwedder
Posts: 1358
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Timer that counts up when pressing hotkey?

Post by Rohwedder » 25 Jun 2018, 02:13

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
User avatar
Xtra
Posts: 1221
Joined: 02 Oct 2015, 12:15

Re: Timer that counts up when pressing hotkey?

Post by Xtra » 25 Jun 2018, 03:12

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
Post Reply

Return to “Ask For Help”