Re: Scripting BBEdit
Re: Scripting BBEdit
- Subject: Re: Scripting BBEdit
- From: "Serge Belleudy-d'Espinose" <email@hidden>
- Date: Wed, 6 Dec 2000 15:12:58 +0100
At 14:59 +0100 6/12/00, Peter Mathiessen wrote:
>
The problem is that my script deletes the whole line, not just a part of it
>
that I want it to do.
>
<TR>
>
<TD><H2>This line should remain and not be deleted</H2>This line should
>
be deleted</TD>
>
</TR>
>
tell application "BBEdit" to activate
>
set searchFolder to "Macintosh HD:remove text:"
>
set myList to list folder alias searchFolder without invisibles
>
repeat with myFilename in every item in myList
>
set myFile to alias (searchFolder & myFilename)
>
tell application "BBEdit"
>
open myFile
>
Go To Line 2
>
Select Current Line
>
Delete Selection
>
end tell
>
end repeat
BBEdit is just doing exactly what you ask it to do :)
If there's only one such line in each file, you can forget applescript and use a regexp in BBEdit's powerful multi-file search-and-replace.
You would replace
(<TD><H2>.*</H2>).*(</TD>)
with
\1\2
Serge
__ __ __
_ \///\/ _ I N S T I T U T | Serge Belleudy-d'Espinose - IJM
\///\/// J A C Q U E S | 2 place Jussieu - 75251 Paris Cedex 05
_///\///\_ M O N O D | m@il : email@hidden
__/\///\__ Service Informatique | WWW :
http://www.ijm.jussieu.fr/