• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: find/replace in BBEdit
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: find/replace in BBEdit


  • Subject: Re: find/replace in BBEdit
  • From: "Christopher C. Stone" <email@hidden>
  • Date: Mon, 11 Dec 2000 05:54:29 -0600

At 12/10/00 22:20 -0600, Rick Plummer wrought:

> I need to open a file (BBEdit will open it) and replace a string in one line with a reference pulled from Applescript, then resave the file with the original type and creator. I have tried, but I'm afraid it's way beyond me.
___________________________________________________________________________

Hey Rick,

BBEdit does *not* change the existing type and creator codes of files upon saving as some other editors do.

This is for BBEdit 6 and should give you an idea or two:


set bbeDoc to "goofyTestFile.bbe"
set findText to "two"
set replaceText to "* between one and three"

tell application "Finder"
set bbeDoc to (make file at desktop with properties {name:bbeDoc}) as alias
end tell

set txt to "one" & return & "two" & return & "three"

try
set f to open for access bbeDoc with write permission
write txt to f
close access f
on error
close access f
beep 2
end try

tell application "BBEdit"
activate
open bbeDoc with properties {position:{5, 41}}
delay 1
tell front text window
replace findText using replaceText options {starting at top:true}
select line 2
delay 1
select insertion point before line 2
delay 1
save
close
end tell
end tell

tell application "Finder"
open bbeDoc
end tell


Best Regards,

Chris


References: 
 >Re: find/replace in BBEdit (From: Rick Plummer <email@hidden>)

  • Prev by Date: Re: find/replace in BBEdit
  • Next by Date: Re: 1.0000023E+5 to 100000.23 as text?
  • Previous by thread: Re: find/replace in BBEdit
  • Next by thread: standalone app crashes when running concurrently with IE 5.0
  • Index(es):
    • Date
    • Thread