Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Apple Script to Comment Lines in Text Wranger/BBEdit


From   "Fred Wolfe" <fwolfe@arthritis-research.org>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Apple Script to Comment Lines in Text Wranger/BBEdit
Date   Tue, 23 Sep 2008 14:04:04 -0500

What does "zap gremline" mean?

On Tue, Sep 23, 2008 at 1:34 PM, Steven Samuels
<sjhsamuels@earthlink.net> wrote:
> For Mac users who edit do-files in BBEdit or Text Wrangler, here's a simple
> script to comment and uncomment lines in selected text. (Yes, "uncomment" is
> in the dictionary). Although the script can be slow, I find it saves me
> effort compared to inserting and deleting  "/*" and "*/" before and after a
> text block.  Text Wrangler users, substitute "Text Wrangler" in the tell
> statement. To use: open in BBEdit or TW, zap gremline, insert into Script
> Editor, save the script into the BBEdit Scripts folder, and assign a menu
> key combination.
>
> -Steve
>
>
> (*
> Add & remove // in Selection
> Activate  with Menu Key
> *)
>
> tell application "BBEdit"
> activate
> repeat with x in lines of selection of window 1 of text document 1
> if exists character 1 of text of x then
> set start to character 1 of text of x as text
> else
> set start to ""
> end if
> if start is not "/" then
> replace "^" using "// " searching in text of x options {search mode:grep}
> else
> replace "^// " using "" searching in text of x options {search mode:grep}
> end if
> end repeat
> end tell
>
>
>
>
>
>
> Steven Samuels
> 845-246-0774
> 18 Cantine's Island
> Saugerties, NY 12477
> EFax: 208-498-7441
>
>
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>



-- 
Fred Wolfe
National Data Bank for Rheumatic Diseases
Wichita, Kansas
NDB Office +1 316 263 2125 Ext 0
Research Office +1 316 686 9195
fwolfe@arthritis-research.org
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index