DEV Community

Query Filter
Query Filter

Posted on

key13

#SingleInstance Force
SetTitleMatchMode, 2
CoordMode, ToolTip, Screen

moveCount := 0
active := true

UpdateToolTip() {
    global moveCount, active
    status := active ? "ACTIVE" : "INACTIVE"
    ToolTip, %status% - Moves: %moveCount%, 20, 20
}

UpdateToolTip()

; ===== MAIN COUNTER HOTKEYS =====
Up::
    ; Check if IntelliJ is active
    If WinActive("ahk_exe idea.exe") or WinActive("ahk_exe idea64.exe")
    {
        if (active)
        {
            moveCount++
            UpdateToolTip()
        }
    }
    ; Always send Up key
    SendInput, {Up}
return

Down::
    ; Check if IntelliJ is active
    If WinActive("ahk_exe idea.exe") or WinActive("ahk_exe idea64.exe")
    {
        if (active)
        {
            moveCount--
            UpdateToolTip()
        }
    }
    ; Always send Down key
    SendInput, {Down}
return

; ===== CONTROL HOTKEYS =====
Esc::
    active := !active
    UpdateToolTip()

    ; Hide tooltip after 2 seconds if inactive
    if (!active) {
        Sleep, 2000
        if (!active) {
            ToolTip
        }
    }
return

^r::  ; Ctrl+R to reset
    moveCount := 0
    UpdateToolTip()
    SoundBeep, 500, 200
return

F1::  ; Show status
    status := active ? "ACTIVE" : "INACTIVE"
    MsgBox, Status: %status%`nMoves: %moveCount%
return
Enter fullscreen mode Exit fullscreen mode

Top comments (0)