DEV Community

Query Filter
Query Filter

Posted on

key14

#SingleInstance Force
#NoEnv
SetTitleMatchMode, 2
CoordMode, ToolTip, Screen

moveCount := 0
active := true

UpdateToolTip() {
    global moveCount, active
    if (active) {
        ToolTip, ACTIVE - Moves: %moveCount%, 20, 20
    } else {
        ToolTip, INACTIVE - Moves: %moveCount%, 20, 20
        SetTimer, HideInactiveToolTip, -1500
    }
}

UpdateToolTip()

HideInactiveToolTip:
    if (!active) {
        ToolTip
    }
return

; ===== HOTKEYS THAT ONLY WORK IN INTELLIJ =====
#If WinActive("ahk_exe idea.exe") or WinActive("ahk_exe idea64.exe")

Up::
    if (!active)
        return

    ; Add a small delay to ensure proper processing
    KeyWait, Up, T0.1

    moveCount++
    UpdateToolTip()

    ; Use $ to prevent recursion
    SendInput, {Blind}{Up}
return

Down::
    if (!active)
        return

    KeyWait, Down, T0.1

    moveCount--
    UpdateToolTip()

    SendInput, {Blind}{Down}
return

#If  ; End context-sensitive hotkeys

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

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

F1::  ; Debug: Check if in IntelliJ
    If WinActive("ahk_exe idea.exe") or WinActive("ahk_exe idea64.exe")
    {
        WinGetTitle, title, A
        MsgBox, In IntelliJ!`nTitle: %title%`nCount: %moveCount%
    }
    else
    {
        MsgBox, NOT in IntelliJ
    }
return

F2::  ; Force send Up key (for testing)
    SendInput, {Up}
    ToolTip, F2 pressed - Sent Up, 20, 20
    SetTimer, RemoveToolTip, -1000
return

RemoveToolTip:
    ToolTip
return
Enter fullscreen mode Exit fullscreen mode

Top comments (0)