On Jan 11, 2012, at 12:40, John Johnson wrote:
> ... I am thinking that I could have one or two files that would let me use
> BBEdit to map from one string to the new string, with a global multi-file
> search and replace ...
______________________________________________________________________
Hey John,
This is an extremely basic proof of concept.
It finds files in the container of the current project document and uses the
items in the text variable findRepl to do the substitutions.
It would not be difficult to use a text file for the substitution pairs.
Perl I think would be a more efficient tool for this job, but BBEdit can sure
do it.
--
Best Regards,
Chris
______________________________________________________________________
try
set findRepl to "
chris •••••
stone •••••
"
set findRepl to paragraphs 2 thru -2 of findRepl
set AppleScript's text item delimiters to tab
tell application "BBEdit"
set projectFile to (file of front project document) as alias
if projectFile ≠ missing value then
tell application "Finder" to set projFileCont to container of projectFile
as alias
repeat with i in findRepl
set _find to first text item of i
set _replace to last text item of i
set bbrep to replace _find using _replace searching in projFileCont ¬
options {backwards:false, case sensitive:false, extend
selection:false, match words:false, returning results:true, search mode:grep,
showing results:false, starting at top:true, wrap around:false} ¬
saving true ¬
with recursion
end repeat
end if
end tell
on error errMsg number errNum
set {cr, sep} to {return, "------------------------------------------"}
set e to sep & cr & "Error: " & errMsg & cr & sep & cr & "Error Number: " &
errNum & cr & sep
beep
display dialog e
end try
--
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>