At 09:03 -0400 20/08/2011, Verdon Vaillancourt wrote:

I am writing a tiny applescript, that I invoke with a clipping, to do a search/replace on a string and return the string. I'm mostly there.

My string might look like this...
C EM       Am7    F

The result looks like this...
[C] [EM]       [Am7]    [F]


With your string selected, insert this clipping:

#script /posix/path/to/a.scpt#


which calls the AppleScript script:

-- a.scpt
tell application "BBEdit" to set _sele to get selection
do shell script "perl -e '$_ = qq~" & _sele & "~;
s~(\\w+)~[$1]~g;  print;'"

This will work on multiple line selections as well.

JD

--
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 bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
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 "supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>

Reply via email to