• TextWarangler macros?

    From JF Mezei@21:1/5 to All on Thu Aug 5 01:20:42 2021


    I need to change a bunch of these:

    <!-- M02 Vancortlandt 2 -->
    <gx:FlyTo>
    <gx:duration>25.0</gx:duration>
    <gx:flyToMode>smooth</gx:flyToMode>
    <Camera>
    <longitude>-73.895308</longitude>
    <latitude>40.893030</latitude>
    <altitude>78</altitude>
    <heading>199.1</heading>
    <tilt> 65</tilt>
    <roll>0</roll>
    <altitudeMode>absolute</altitudeMode>
    </Camera>
    </gx:FlyTo>


    into:


    <!-- M02 Vancortlandt 2 -->
    <gx:FlyTo>
    <gx:duration>25.0</gx:duration>
    <gx:flyToMode>smooth</gx:flyToMode>
    <Camera>
    <neme>M02 Vancortlandt 2</name>
    <longitude>-73.895308</longitude>
    <latitude>40.893030</latitude>
    <altitude>78</altitude>
    <heading>199.1</heading>
    <tilt> 65</tilt>
    <roll>0</roll>
    <altitudeMode>absolute</altitudeMode>
    </Camera>
    </gx:FlyTo>


    In other words, copy the contents of the comment and then insert a new
    line under <Camera> with a <name>xxxxxxxx</name>

    What would be the best way to do this? Does the purchased copy of bbedit
    have such function?


    (In VMS, I could record set of keystrokes and then play them for instance
    FIND <!-- , SELECT, FIND -->, COPY, FIND <Camera>,
    RETURN, TAB TAB, type <name> PASTE, type </name>

    and then assign this to a key and just press key repeatedly. ( there is
    also a repeat command).

    Just wondering if such functionality exists in TextWrangler of if I
    upgrade to BBedit.


    (the <name> is not technically part of Camera, but this allows me to
    easily use PHP simpleXML to convert this to a set of placemarks and then
    back to a Camera tour with the reciprocal script when I already wrote).
    (There is a lot of trial and error because Google Earth insists in some
    quirks such as turning camera towards the left before you begin a large
    right turn).

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lewis@21:1/5 to JF Mezei on Thu Aug 5 06:35:21 2021
    In message <KyKOI.688$qf5.360@fx07.iad> JF Mezei <jfmezei.spamnot@vaxination.ca> wrote:
    Subject: TextWarangler macros?

    TextWrangler was EOLed five years ago. You should use the free
    version of BBEdit.

    What would be the best way to do this? Does the purchased copy of bbedit
    have such function?

    You do not need to pay for BBEdit to use its regex function.

    and then assign this to a key and just press key repeatedly. ( there is
    also a repeat command).

    Once you write the rege you can simply say "replace all" and that will
    replace all instances in the file. Or in multiple files.

    Just wondering if such functionality exists in TextWrangler of if I
    upgrade to BBedit.

    I do not remember what TextWrangler supported, but I suspect it did
    support regex. BBEdit is better, however, and has a fully supported free version.

    --
    "Are you pondering what I'm pondering?"
    "Well, I think so, Brain, but snort no, no, it's too stupid!"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Percival John Hackworth@21:1/5 to Lewis on Sat Aug 7 00:30:47 2021
    On 04-Aug-2021 at 11:35:21PM PDT, "Lewis" <g.kreme@kreme.dont-email.me> wrote:

    In message <KyKOI.688$qf5.360@fx07.iad> JF Mezei <jfmezei.spamnot@vaxination.ca> wrote:
    Subject: TextWarangler macros?

    TextWrangler was EOLed five years ago. You should use the free
    version of BBEdit.

    What would be the best way to do this? Does the purchased copy of bbedit
    have such function?

    You do not need to pay for BBEdit to use its regex function.

    and then assign this to a key and just press key repeatedly. ( there is
    also a repeat command).

    Once you write the rege you can simply say "replace all" and that will replace all instances in the file. Or in multiple files.

    Just wondering if such functionality exists in TextWrangler of if I
    upgrade to BBedit.

    I do not remember what TextWrangler supported, but I suspect it did
    support regex. BBEdit is better, however, and has a fully supported free version.

    --
    "Are you pondering what I'm pondering?"
    "Well, I think so, Brain, but snort no, no, it's too stupid!"

    When I wanted to write some automation for BBEdit, I used the Applescript extensions. That worked great for automating editing a file.

    The "macros" you posted are nothing like the scripts for BBEdit.
    --
    DeeDee, don't press that button! DeeDee! NO! Dee...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lewis@21:1/5 to Percival John Hackworth on Sat Aug 7 06:53:18 2021
    In message <in62hnF7jpuU1@mid.individual.net> Percival John Hackworth <pjh@nanoworks.com> wrote:
    On 04-Aug-2021 at 11:35:21PM PDT, "Lewis" <g.kreme@kreme.dont-email.me> wrote:

    In message <KyKOI.688$qf5.360@fx07.iad> JF Mezei
    <jfmezei.spamnot@vaxination.ca> wrote:
    Subject: TextWarangler macros?

    TextWrangler was EOLed five years ago. You should use the free
    version of BBEdit.

    What would be the best way to do this? Does the purchased copy of bbedit >>> have such function?

    You do not need to pay for BBEdit to use its regex function.

    and then assign this to a key and just press key repeatedly. ( there is >>> also a repeat command).

    Once you write the rege you can simply say "replace all" and that will
    replace all instances in the file. Or in multiple files.

    Just wondering if such functionality exists in TextWrangler of if I
    upgrade to BBedit.

    I do not remember what TextWrangler supported, but I suspect it did
    support regex. BBEdit is better, however, and has a fully supported free
    version.

    When I wanted to write some automation for BBEdit, I used the Applescript extensions. That worked great for automating editing a file.

    You do not need an AppleScript for the task described though, you just
    need a regex.


    --
    Do not meddle in the affairs of wizards for they are subtle and quick
    to anger.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From JF Mezei@21:1/5 to Lewis on Sat Aug 7 13:39:02 2021
    On 2021-08-07 02:53, Lewis wrote:

    You do not need an AppleScript for the task described though, you just
    need a regex.


    Can you provide an example of regex copying text from one area of text
    and then adding text elsewhere (including the copied text).

    I have only used regex to locate text and replace it.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lewis@21:1/5 to JF Mezei on Sun Aug 8 00:55:08 2021
    In message <WyzPI.6849$EF2.3395@fx47.iad> JF Mezei <jfmezei.spamnot@vaxination.ca> wrote:
    On 2021-08-07 02:53, Lewis wrote:

    You do not need an AppleScript for the task described though, you just
    need a regex.

    Can you provide an example of regex copying text from one area of text
    and then adding text elsewhere (including the copied text).

    Fred Smith
    John Smthe
    Alice Smythe

    At its simplest,

    search for "^([^ ]+) (.*)"
    replace with \2, \1

    Smith, Fred
    Smthe, John
    Smythe, Alice

    I have only used regex to locate text and replace it.

    BBEdit manual (under the Help menu) has an entire chapter on regex/grep.


    --
    "Are you pondering what I'm pondering?"
    "Uh... yeah, Brain, but where are we going to find rubber pants our
    size?"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From JF Mezei@21:1/5 to Lewis on Sat Aug 7 23:49:41 2021
    On 2021-08-07 20:55, Lewis wrote:

    search for "^([^ ]+) (.*)"
    replace with \2, \1


    Thanks. wasn't aware there were "variables" in REGEX.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)