Thank you so much, Chris. That whole "tell" on objects is something I need to get a better handle on.
On Tuesday, January 29, 2013 4:01:33 PM UTC-6, Christopher Stone wrote: > > On Jan 29, 2013, at 12:00, David Schutz <[email protected] <javascript:>> > wrote: > > Now all the scripts I've written in the past with these commands are > broken, and I can't figure out how to target selected text in a document > and change it. > > ______________________________________________________________________ > > Hey David, > > Here's an amended version of your script that works with BBEdit 10.5.2 > (3259): > > > ------------------------------------------------------------------------------------------- > > tell *application* "BBEdit" > set myDoc to *text document* 1 > set myReplacementString to "hello" > *find* "###" searching in *text* of myDoc options {search mode:literal, > starting > at top:false} with selecting match > set selection of *window* of myDoc to myReplacementString > end tell > > > ------------------------------------------------------------------------------------------- > > Now here's how I would write it: > > > ------------------------------------------------------------------------------------------- > > tell *application* "BBEdit" > set myReplacementString to "hello" > tell *text* of *text document* 1 > *find* "###" options {search mode:literal, starting at top:false} with > selecting > match > set *text* of selection to myReplacementString > end tell > end tell > > > ------------------------------------------------------------------------------------------- > > (I'm assuming you have a reason for using find/replace rather than just > replace.) > > -- > 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> --- You received this message because you are subscribed to the Google Groups "BBEdit Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
