DEV Community

Query Filter
Query Filter

Posted on

docker-156

; Ensure the script runs with optimal clipboard handling speeds
#NoEnv
SetBatchLines, -1
SendMode Input

; --- CONFIGURATION ---
TargetLibrary := "jaxb-api" ; The library text snippet you want to find
LibraryIndex := 0
FoundMatch := false

MsgBox, 64, AHK Finder, Please click inside your IntelliJ Dependencies list box, then press OK to begin counting.

; 1. Jump to the absolute top of the dependencies list
Send, {Home}
Sleep, 150

; 2. Iterate down while keeping count
Loop, 500 {
    LibraryIndex++

    ; Clear the clipboard so ClipWait can reliably measure incoming data
    Clipboard := "" 

    ; Send Ctrl+C to copy the text of the currently highlighted row
    Send, ^c 
    ClipWait, 0.2 ; Wait up to 200ms for data to populate

    ; Check if the row text contains your target library name (case-insensitive)
    if (InStr(Clipboard, TargetLibrary)) {
        FoundMatch := true
        break
    }

    ; Move down to the next library item in the list
    Send, {Down}
    Sleep, 40 ; Safe delay window for your specific build environment
}

; 3. Output the calculation result
if (FoundMatch) {
    MsgBox, 64, Success, Found "%TargetLibrary%" at UI Index row: %LibraryIndex%
} else {
    MsgBox, 16, Failed, Could not locate "%TargetLibrary%" within the first 500 entries.
}

ExitApp
Enter fullscreen mode Exit fullscreen mode

Top comments (0)