I am trying to using RegExMatch and the more I learn the more confusing it gets. Lol.
What I am trying to do is find [] at the end of a text in an active window if it exists (EradRIS) and move the cursor or caret to that position and highlight it.
For example here is the haystack:
So far I get the code to find "IMPRESSION []" but I am not sure how to select just the "[]"Findings
The right kidney measures [8.9 x 3.8 x 4.5] cm demonstrating hydronephrosis containing an inferior echogenic focus measuring 0.8 x 0.3 x 1.0 cm with shadowing.
The left kidney measures [12.8 x 6.8 x 5.3] cm and is unremarkable.
Visualized aorta is normal in caliber measuring up to 1.9 cm.
Unremarkable IVC.
Incidental finding: Fatty liver.
IMPRESSION
[]
Code: Select all
CLEARUS:
if WinExist(EradRis)
WinActivate
Setwindelay, 10
Clipboard := ""
sleep, 10
GuiControl, Focus, MainEdit
Sendinput, {Ctrl down}ac{Ctrl up}
ClipWait, 1
USTEXT := Clipboard
;msgbox, % USTEXT
RegExMatch(USText, "IMPRESSION", USTEX)
;msgbox, %USTEX%
if WinExist(EradRis)
WinActivate
GuiControl, Focus, MainEdit
Return
Thank you!