On Oct 23, 2010, at 20:29, dcn wrote:
> It would save me a great deal of time if I could build the search/ replace 
> sequence to some sort of macro as in Excel. Since macros don't seem to be 
> formally supported in BBEdit (AFAIK), I wondered if a script process would do 
> the job.
______________________________________________________________________

Hey dn,

That type of operation is quite simple to script.  Run this from the 
Applescript Editor, and you'll see.

# =====
property aSentence : "Now is the time for all good " & ¬
 "men to come to the aid of their country."

tell application "BBEdit"
 activate
 try
  
  set newDoc to make new text window
  repeat 30 times
   set end of newDoc's text to aSentence & linefeed
  end repeat
  
  tell front text window
   
   set resultNumber1 to replace ¬
    "good.+?of" using "citizens to stand up for" options ¬
    {search mode:grep, starting at top:true, case sensitive:false}
   
   set resultNumber2 to replace ¬
    "(.$)" using " if they care\\1" options ¬
    {search mode:grep, starting at top:true, case sensitive:false}
   
   set resultNumber3 to replace ¬
    "(.$)" using "!!!!" options ¬
    {search mode:grep, starting at top:true, case sensitive:false}
   
  end tell
 on error errMsg number errNum
  beep
  display dialog "Error: " & errMsg & return & "Error Number: " & errNum
 end try
end tell
# =====

--
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