Skip to content
Main navigation
All integrations

AutoHotkey

How it works:A keyboard shortcut toggles the timer in any program on Windows, without switching windows.

On Windows, AutoHotkey turns any key combination into a timer button. The script needs nothing but AutoHotkey v2 and the HTTP interface built into Windows, no further libraries; after every press a notification shows where you stand.

  1. Under Settings, API and devices, add a device of the kind "Other device" and copy the token.
  2. Install AutoHotkey v2.
  3. Save the script below as horaka.ahk (UTF-8) and start it with a double click. For more projects, copy the line with ^!F9 and give it its own key and alias.
  4. To start the script when you sign in, put a shortcut into the startup folder (Windows+R, shell:startup).
Example (autohotkey)
#Requires AutoHotkey v2.0
#SingleInstance Force

Address := "https://api.horaka.com/v1"
Token := "YOUR_TOKEN"

; Ctrl+Alt+F9: toggle project, Ctrl+Alt+F10: stop, Ctrl+Alt+F11: show status
^!F9::Notify("/track/toggle", '{"project": "PROJECT"}')
^!F10::Notify("/track/stop")
^!F11::Notify()

Horaka(Method, Path, Body := "") {
    Request := ComObject("WinHttp.WinHttpRequest.5.1")
    Request.Open(Method, Address Path, false)
    Request.SetRequestHeader("Authorization", "Bearer " Token)
    Request.SetRequestHeader("Content-Type", "application/json; charset=utf-8")
    Request.Send(Body)
    if (Request.Status != 200)
        throw Error("HTTP " Request.Status)
    return Request.ResponseText
}

Notify(Path := "", Body := "{}") {
    try {
        if (Path != "")
            Horaka("POST", Path, Body)
        TrayTip(Horaka("GET", "/track/status?format=text"), "Horaka")
    } catch as Problem {
        TrayTip(Problem.Message, "Horaka", "Iconx")
    }
}

Instead of /track/toggle you can use /track/start and /track/switch with the same body; add "activity" next to "project" to book a specific activity. After every press the notification shows today's hours and the running timer. "HTTP 401" means a wrong token, "HTTP 403" means the device may not book on this project or the device limit of your plan is reached.

On some keyboard layouts Ctrl+Alt with a letter is the same as AltGr, which is why the example uses the function keys. Every endpoint is described in the API documentation.

Win back the hours you give away.

Get started in a minute. 14 days of Premium free and without a card, then carry on with Free at no cost or from €4.90 a month with everything for billing.