DEV Community

Query Filter
Query Filter

Posted on

docker-160

; Ensure the script runs with optimal handling speeds for AHK v1.1.33.10
#NoEnv
SetBatchLines, -1
SendMode Input

; --- CONFIGURATION ---
TargetLibrary := "citi_nano_demo" ; Updated target library name
LibraryIndex := 0
MaxRows := 80                     ; Capped search depth to 80 rows
FoundMatch := false

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

; 1. Initialize and display the feedback window showing the read text next to row count
Progress, b w600 H110 zh0 fs10 c00,, Initializing search rows..., AHK Dependencies Finder
Progress, 0

; 2. Jump to the absolute top of the dependencies list
Send, {Home}
Sleep, 300 ; Give IntelliJ time to snap to the top row

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

    ; Clear the clipboard completely to ensure fresh evaluation
    Clipboard := "" 

    ; Trigger the context menu inside IntelliJ and select copy to populate clipboard
    Send, +{F10} 
    Sleep, 60
    Send, {Down 2}{Enter} 
    Sleep, 100

    CurrentRowText := Trim(Clipboard)

    ; Format text for the display box preview
    DisplayText := CurrentRowText
    if (DisplayText = "") {
        DisplayText := "[Empty Clipboard Buffer - Skipping Row]"
    } else if (StrLen(DisplayText) > 75) {
        DisplayText := SubStr(DisplayText, 1, 72) . "..."
    }

    ; Update the visual progress window with the row count and the raw text found
    ProgressPercent := (LibraryIndex / MaxRows) * 100
    Progress, %ProgressPercent%, Row Count: %LibraryIndex% / %MaxRows% `nRead Text: "%DisplayText%", Searching for "%TargetLibrary%"...

    ; Evaluate match condition (case-insensitive)
    if (InStr(CurrentRowText, TargetLibrary)) {
        FoundMatch := true
        break
    }

    ; Move down to the next library item in the list
    Send, {Down}
    Sleep, 60 ; Pacing delay for UI rendering
}

; 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%`nFull Name: %CurrentRowText%
} else {
    MsgBox, 16, Failed, Could not locate "%TargetLibrary%" within the capped %MaxRows% entries.
}

ExitApp
Enter fullscreen mode Exit fullscreen mode

Top comments (0)