Scripting Line Prefix
Hey Folks, Jeeze. It's been a long time since I seriously scripted BBEdit. In this case I want to prefix every line in the front document. This works fine: tell application BBEdit tell front text document set before first word of line 3 to • end tell end tell This doesn't: tell application BBEdit set before first word of every line of front text document to • end tell This does the job perfectly: tell application BBEdit tell front text document add prefix ( lines 1 thru -1 ) prefix • end tell end tell And you can loop through or do a find/replace of course. All this discovered, and I still feel like I'm missing something. Any more useful magic? Thanks. -- 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 bbedit@googlegroups.com To unsubscribe from this group, send email to bbedit+unsubscr...@googlegroups.com 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 supp...@barebones.com rather than posting to the group. -~--~~~~--~~--~--~---
Re: Scripting Line Prefix
Chris~ Why not use a simple grep to do it for you? This works for me: - - - - - - - - - - - - - - - - - - - - Find: (^.+) Replace: •\1 - - - - - - - - - - - - - - - - - - - - Cheers, ~Semper Fi, Mac! = = = = = = = = = = = = = = = = = = = = On Oct 29, 2009, at 11:44 PM, Christopher Stone wrote: Hey Folks, Jeeze. It's been a long time since I seriously scripted BBEdit. In this case I want to prefix every line in the front document. This works fine: tell application BBEdit tell front text document set before first word of line 3 to • end tell end tell This doesn't: tell application BBEdit set before first word of every line of front text document to • end tell This does the job perfectly: tell application BBEdit tell front text document add prefix ( lines 1 thru -1 ) prefix • end tell end tell And you can loop through or do a find/replace of course. All this discovered, and I still feel like I'm missing something. Any more useful magic? Thanks. -- 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 bbedit@googlegroups.com To unsubscribe from this group, send email to bbedit+unsubscr...@googlegroups.com 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 supp...@barebones.com rather than posting to the group. -~--~~~~--~~--~--~---
Re: Scripting Line Prefix
Or why not use the Text - Prefix/Suffix Lines menu item? 2009/10/30, Semper Fidelis semper.fide...@mac.com: Chris~ Why not use a simple grep to do it for you? This works for me: - - - - - - - - - - - - - - - - - - - - Find: (^.+) Replace: •\1 - - - - - - - - - - - - - - - - - - - - Cheers, ~Semper Fi, Mac! = = = = = = = = = = = = = = = = = = = = On Oct 29, 2009, at 11:44 PM, Christopher Stone wrote: Hey Folks, Jeeze. It's been a long time since I seriously scripted BBEdit. In this case I want to prefix every line in the front document. This works fine: tell application BBEdit tell front text document set before first word of line 3 to • end tell end tell This doesn't: tell application BBEdit set before first word of every line of front text document to • end tell This does the job perfectly: tell application BBEdit tell front text document add prefix ( lines 1 thru -1 ) prefix • end tell end tell And you can loop through or do a find/replace of course. All this discovered, and I still feel like I'm missing something. Any more useful magic? Thanks. -- 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 bbedit@googlegroups.com To unsubscribe from this group, send email to bbedit+unsubscr...@googlegroups.com 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 supp...@barebones.com rather than posting to the group. -~--~~~~--~~--~--~---
Re: Scripting Line Prefix
Agreed -- that's an even simpler solution I overlooked. ~Semper Fi, Mac! = = = = = = = = = = = = = = = = = = = = On Oct 30, 2009, at 8:22 AM, Jan Pieter Kunst wrote: Or why not use the Text - Prefix/Suffix Lines menu item? snip../snip --~--~-~--~~~---~--~~ 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 bbedit@googlegroups.com To unsubscribe from this group, send email to bbedit+unsubscr...@googlegroups.com 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 supp...@barebones.com rather than posting to the group. -~--~~~~--~~--~--~---
Re: Scripting Line Prefix
Hey Guys, On Oct 30, 2009, at 10:12, Semper Fidelis wrote: Why not use a simple grep to do it for you? This works for me: I did mention that possibility, and this can be easily scripted as well. On Oct 30, 2009, at 01:44, Christopher Stone wrote: And you can loop through or do a find/replace of course. All this discovered, and I still feel like I'm missing something. Any more useful magic? tell application BBEdit tell front text document replace ^ using url = searching in it ¬ options {search mode:grep, showing results:false} with saving end tell end tell On Oct 30, 2009, at 10:22, Jan Pieter Kunst wrote: Or why not use the Text - Prefix/Suffix Lines menu item? I actually did this via script, and that's the point of the exercise. tell application BBEdit tell front text document add prefix (lines 1 thru -1) prefix url = end tell end tell I'm starting to re-learn how to script BBEdit, and this step is a small part of a more complex filter I'm building. That filter is bound to a keyboard shortcut and preprocesses an html file for use with curl. Eventually I'll probably move to a Perl filter, but my Perl skills are quite rudimentary at the moment. On the Perl topic does anyone have recommendations for online resources and books for a rank beginner? Thanks. -- 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 bbedit@googlegroups.com To unsubscribe from this group, send email to bbedit+unsubscr...@googlegroups.com 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 supp...@barebones.com rather than posting to the group. -~--~~~~--~~--~--~---
Re: Scripting Line Prefix
Get the Camel Book from O'Reilly (the publisher). I've forgotten the actual (real) title of the Camel Book, but if you go to the O'Reilly web site and search for Perl, you'll come up with several good choices. --Sent from the iPhone of Semper Fidelis On Oct 30, 2009, at 13:42, Christopher Stone ccstone1...@gmail.com wrote: Hey Guys, I'm starting to re-learn how to script BBEdit, and this step is a small part of a more complex filter I'm building. That filter is bound to a keyboard shortcut and preprocesses an html file for use with curl. Eventually I'll probably move to a Perl filter, but my Perl skills are quite rudimentary at the moment. On the Perl topic does anyone have recommendations for online resources and books for a rank beginner? Thanks. -- 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 bbedit@googlegroups.com To unsubscribe from this group, send email to bbedit+unsubscr...@googlegroups.com 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 supp...@barebones.com rather than posting to the group. -~--~~~~--~~--~--~---
Re: Scripting Line Prefix
On Fri, Oct 30, 2009 at 02:39:08PM -0700, Semper Fidelis wrote: Get the Camel Book from O'Reilly (the publisher). I've forgotten the actual (real) title of the Camel Book, but if you go to the O'Reilly web site and search for Perl, you'll come up with several good choices. The actual title of the Camel Book is Programming Perl. Ronald --~--~-~--~~~---~--~~ 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 bbedit@googlegroups.com To unsubscribe from this group, send email to bbedit+unsubscr...@googlegroups.com 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 supp...@barebones.com rather than posting to the group. -~--~~~~--~~--~--~---
Re: Scripting Line Prefix
At 17:41 -0400 10/30/09, Ronald J Kimball wrote: The actual title of the Camel Book is Programming Perl. At 15:42 -0500 10/30/09, Christopher Stone wrote: On the Perl topic does anyone have recommendations for online resources and books for a rank beginner? There is also a smaller O'Reilly book called Learning Perl. It's older but perhaps more in tune with the rank beginner. -- -- Halloween == Oct 31 == Dec 25 == Christmas -- --~--~-~--~~~---~--~~ 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 bbedit@googlegroups.com To unsubscribe from this group, send email to bbedit+unsubscr...@googlegroups.com 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 supp...@barebones.com rather than posting to the group. -~--~~~~--~~--~--~---