DEV Community

Query Filter
Query Filter

Posted on

key12

#SingleInstance Force
SetTitleMatchMode, 2
CoordMode, ToolTip, Screen

moveCount := 0
active := true

; Show initial tooltip
ToolTip, Script started - ACTIVE`nMoves: 0, 20, 20
Sleep, 2000)  ; Show for 2 seconds
ToolTip  ; Clear it

; ===== DEBUG HOTKEYS (Global - always work) =====
F1::
    ; Check if IntelliJ is active
    If WinActive("ahk_exe idea.exe") or WinActive("ahk_exe idea64.exe")
        MsgBox, IntelliJ is ACTIVE - Hotkeys should work!
    else
        MsgBox, IntelliJ is NOT active
return

F2::
    ; Show current state
    MsgBox, State: active=%active%`nCount: %moveCount%
return

F3::
    ; Test if Up key sends properly
    SendInput, {Up}
    MsgBox, Up key sent
return

; ===== MAIN COUNTER HOTKEYS =====
; Simple approach - test without #If first
Up::
    ToolTip, Up pressed!, 20, 20
    SetTimer, RemoveTip, -1000

    ; Only count if IntelliJ is active
    If WinActive("ahk_exe idea.exe") or WinActive("ahk_exe idea64.exe")
    {
        if (active)
        {
            moveCount++
            MsgBox, Counted! Now: %moveCount%  ; Temporary to see if it works
        }
    }

    ; Always send Up key
    SendInput, {Up}
return

Down::
    ToolTip, Down pressed!, 20, 20
    SetTimer, RemoveTip, -1000

    ; Only count if IntelliJ is active
    If WinActive("ahk_exe idea.exe") or WinActive("ahk_exe idea64.exe")
    {
        if (active)
        {
            moveCount--
            MsgBox, Counted! Now: %moveCount%  ; Temporary to see if it works
        }
    }

    ; Always send Down key
    SendInput, {Down}
return

RemoveTip:
    ToolTip
return

; ===== CONTROL HOTKEYS =====
Esc::
    active := !active
    if (active)
    {
        ToolTip, ACTIVE`nMoves: %moveCount%, 20, 20
        SetTimer, RemoveTip, -2000
    }
    else
    {
        ToolTip, INACTIVE`nMoves: %moveCount%, 20, 20
        SetTimer, RemoveTip, -1000
    }
return

^r::  ; Ctrl+R to reset
    moveCount := 0
    ToolTip, Reset to 0!, 20, 20
    SetTimer, RemoveTip, -1000
return
Enter fullscreen mode Exit fullscreen mode

Top comments (0)