Your script worked perfectly, Chris! Thank you so much, and everyone else for the advice. And Fletcher, this script will have to run through about 50 text files a day that have been exported from a FMP database, so hands off is exactly what I wanted.
Again, THANK YOU! You guys rock! On May 23, 9:10 pm, Christopher Stone <[email protected]> wrote: > On May 23, 2012, at 15:33, Lalock wrote: > > > It seems like this should be easy, but everything I've tried has failed. > > I'm trying to do a find and replace, then delete from a given text point > > down to the end of the document. Here's my latest effort: > > ... > > set theStart to selection's characterOffset > > ______________________________________________________________________ > > Hey There, > > Part of the problem is that you're not working from a selection. You don't > have with selecting match in your find specification. > > Take a look at this and see if it's close to what you're trying to do. > > set theFile to alias "Thor:Users:chris:test_directory:test.txt" > tell application "BBEdit" > activate > open theFile opening in new_window > tell text of text document 1 > replace "°°" using "\\r" options {search mode:literal, > starting at top:true, wrap around:false, backwards:false, case > sensitive:false, match words:false, extend selection:false} > set find_results to find "\\r@rule:" options {search > mode:grep, starting at top:false, wrap around:true, backwards:false, case > sensitive:false, match words:false, extend selection:false} > delete (characters (get characterOffset of (found object of > find_results)) thru -1) > end tell > 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>
