DEV Community

Query Filter
Query Filter

Posted on

docker-157

; 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
MaxRows := 800              ; Capped at 800 entries max
FoundMatch := false

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

; 1. Initialize and display the progress window tracking feedback
Progress, b w300 H90 zh0 fs11 c00,, Searching list..., AHK Dependencies Finder
Progress, 0 ; Start progress at zero percent

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

; 3. Iterate down while keeping count
Loop, %MaxRows% {
    LibraryIndex++

    ; Update the visual progress window with the current row index
    ProgressPercent := (LibraryIndex / MaxRows) * 100
    Progress, %ProgressPercent%, Row Count: %LibraryIndex% / %MaxRows%, Searching for "%TargetLibrary%"...

    ; 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
}

; 4. Close the progress feedback window
Progress, Off

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

ExitApp
Enter fullscreen mode Exit fullscreen mode

Top comments (0)