On Mar 25, 2012, at 20:31, Balthasar Indermuehle wrote:
> Is it possible to create a custom set of matching word terminators? i.e. make 
> it recognise FOR as the "opening bracket" to a ENDFOR "closing bracket" ?
> 
> I'm still on version 9.6.3, so if 10 can do it, a reason for an upgrade!
______________________________________________________________________

Hey Balt,

You can do pretty much what you want, although the logics can get interesting.

try
  
  tell application "BBEdit"
    tell text of front text window
      find "\\bFOR\\b" options {search mode:grep, starting at top:false, wrap 
around:false, backwards:true, case sensitive:true, match words:false} with 
selecting match
      find "\\bENDFOR\\b" options {search mode:grep, starting at top:false, 
wrap around:false, backwards:false, case sensitive:true, match words:false, 
extend selection:true} with selecting match
    end tell
  end tell
  
on error eMsg number eNum
  set {c, s} to {return, "------------------------------------------"}
  set e to s & c & "Error: " & eMsg & c & s & c & "Error Number: " & eNum & c & 
s
  beep
  display dialog e
end try

This is case-sensitive for FOR...ENDFOR.

It expects the cursor to be between the terminators.

Save the script.
Put it in the Script Menu.
Give it a keyboard shortcut.
And go to town.

--
Best Regards,
Chris


-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
<http://groups.google.com/group/bbedit?hl=en>
If you have a feature request or would like to report a problem, 
please email "[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>

Reply via email to