Hello, I'm trying to write a simple script to run sequentially grep patterns saved in BBEdit. I asked Claude to do so and i got this code:
tell application "BBEdit"
set theDoc to front document
set grepPatterns to {"PATTERN1", "PATTERN2", "PATTERN3"}
repeat with currentPattern in grepPatterns
set foundRange to find currentPattern searching in text of theDoc options {search mode:grep, starting at top:true, wrap around:false, backwards:false, case sensitive:false, match words:false, extend selection:false}
if foundRange is not "Not found" then
select foundRange
delay 1
end if
end repeat
end tell
It gives me this error:

Can anyone point me in the right direction? Thanks in advance.