• Login
Community
  • Login

Having trouble getting a macro to work as desired

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
macrosmacro recordermacro
4 Posts 3 Posters 279 Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D
    discgolfdc
    last edited by Sep 16, 2022, 1:22 AM

    Hi, all, New here. Thanks for having me.

    I first got dropped off at the Search/Replace desk, but I’m not sure this belongs there, as I’m not having problems with S/R, but with the macro I recorded that is supposed to govern it.

    I often have occasion to work with spintax, and I recorded a small macro that takes a list of items and converts it into a spintax-usable string…and another that will go the other way.

    The first macros I recorded apply the actions to the entire document.

    There will be some times, however, where I might want to have these conversions performed on only a portion of the document.

    I re-recorded the macro (both ways … text to spintax and spintax to text), being sure to have the “In Selection” checked in the Search/Replace dialog box while I performed the operations on the portion of the document I was working with.

    While I was recording the macro, everything was proceeding and looking exactly like I would want it to, given any list of terms that were a portion of the document that I’d want converted.

    With the macro saved and attempting to deploy it on another list of terms in my document, it…uh…didn’t look quite how I’d hoped. Far from.

    I’m including the macro codes here in the hopes that someone might be able to tell me what might have gone wrong and where.

    The problem I’m having is with the second two macros, which say “Selection Only.” Basically, what I was hoping to achieve with the second two macros is the same thing as with the first two macros, just on “selected text” as opposed to globally.

    Thank you, and the xml follows.

    <Macro name="List to Spintax (Entire Document)" Ctrl="no" Alt="yes" Shift="no" Key="219">
                <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
                <Action type="3" message="1601" wParam="0" lParam="0" sParam="\r\n" />
                <Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
                <Action type="3" message="1602" wParam="0" lParam="0" sParam="|" />
                <Action type="3" message="1702" wParam="0" lParam="770" sParam="" />
                <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
                <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
                <Action type="3" message="1601" wParam="0" lParam="0" sParam="^" />
                <Action type="3" message="1625" wParam="0" lParam="2" sParam="" />
                <Action type="3" message="1602" wParam="0" lParam="0" sParam="{" />
                <Action type="3" message="1702" wParam="0" lParam="770" sParam="" />
                <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
                <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
                <Action type="3" message="1601" wParam="0" lParam="0" sParam="$" />
                <Action type="3" message="1625" wParam="0" lParam="2" sParam="" />
                <Action type="3" message="1602" wParam="0" lParam="0" sParam="}" />
                <Action type="3" message="1702" wParam="0" lParam="770" sParam="" />
                <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
            </Macro>
            <Macro name="Spintax to List (Entire Document)" Ctrl="no" Alt="yes" Shift="no" Key="221">
                <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
                <Action type="3" message="1601" wParam="0" lParam="0" sParam="{" />
                <Action type="3" message="1625" wParam="0" lParam="2" sParam="" />
                <Action type="3" message="1602" wParam="0" lParam="0" sParam="" />
                <Action type="3" message="1702" wParam="0" lParam="770" sParam="" />
                <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
                <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
                <Action type="3" message="1601" wParam="0" lParam="0" sParam="}" />
                <Action type="3" message="1625" wParam="0" lParam="2" sParam="" />
                <Action type="3" message="1602" wParam="0" lParam="0" sParam="" />
                <Action type="3" message="1702" wParam="0" lParam="770" sParam="" />
                <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
                <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
                <Action type="3" message="1601" wParam="0" lParam="0" sParam="|" />
                <Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
                <Action type="3" message="1602" wParam="0" lParam="0" sParam="\r\n" />
                <Action type="3" message="1702" wParam="0" lParam="770" sParam="" />
                <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
            </Macro>
            <Macro name="List to Spintax (Selection Only)" Ctrl="no" Alt="yes" Shift="yes" Key="219">
                <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
                <Action type="3" message="1601" wParam="0" lParam="0" sParam="\r\n" />
                <Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
                <Action type="3" message="1602" wParam="0" lParam="0" sParam="|" />
                <Action type="3" message="1702" wParam="0" lParam="898" sParam="" />
                <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
                <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
                <Action type="3" message="1601" wParam="0" lParam="0" sParam="^" />
                <Action type="3" message="1625" wParam="0" lParam="2" sParam="" />
                <Action type="3" message="1602" wParam="0" lParam="0" sParam="{" />
                <Action type="3" message="1702" wParam="0" lParam="898" sParam="" />
                <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
                <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
                <Action type="3" message="1601" wParam="0" lParam="0" sParam="$" />
                <Action type="3" message="1625" wParam="0" lParam="2" sParam="" />
                <Action type="3" message="1602" wParam="0" lParam="0" sParam="}" />
                <Action type="3" message="1702" wParam="0" lParam="898" sParam="" />
                <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
            </Macro>
            <Macro name="Spintax to List (Selection Only)" Ctrl="no" Alt="yes" Shift="yes" Key="221">
                <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
                <Action type="3" message="1601" wParam="0" lParam="0" sParam="{" />
                <Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
                <Action type="3" message="1602" wParam="0" lParam="0" sParam="" />
                <Action type="3" message="1702" wParam="0" lParam="898" sParam="" />
                <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
                <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
                <Action type="3" message="1601" wParam="0" lParam="0" sParam="}" />
                <Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
                <Action type="3" message="1602" wParam="0" lParam="0" sParam="" />
                <Action type="3" message="1702" wParam="0" lParam="898" sParam="" />
                <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
                <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
                <Action type="3" message="1601" wParam="0" lParam="0" sParam="|" />
                <Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
                <Action type="3" message="1602" wParam="0" lParam="0" sParam="\r\n" />
                <Action type="3" message="1702" wParam="0" lParam="898" sParam="" />
                <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
            </Macro>
    
    A P 2 Replies Last reply Sep 16, 2022, 1:02 PM Reply Quote 0
    • A
      Alan Kilborn @discgolfdc
      last edited by Alan Kilborn Sep 16, 2022, 1:02 PM Sep 16, 2022, 1:02 PM

      @discgolfdc

      It would probably help if you provide a sample of some text it goes wrong on and of course indicate what the selected-text is in that.

      1 Reply Last reply Reply Quote 1
      • P
        PeterJones @discgolfdc
        last edited by PeterJones Sep 16, 2022, 1:05 PM Sep 16, 2022, 1:03 PM

        @discgolfdc said in Having trouble getting a macro to work as desired:

        I first got dropped off at the Search/Replace desk, but I’m not sure this belongs there, as I’m not having problems with S/R, but with the macro I recorded that is supposed to govern it.

        I’m including the macro codes here

        While having the macros here will help someone here help you, I have no clue whether any of the regulars here knows anything about “spintaxt” (I know I don’t). As such, we don’t have any “spintaxt” lying around – or be able to tell the difference between “it didn’t look quite how I’d hoped” vs “it looked exactly like what I wanted”. It may be difficult, then, for us to help you debug.

        On the other hand, if you had provided us with example “before” text, and examples of “after” text that you want vs the “after” text that you actually got, then we might have enough information to start helping you.

        To share that example text, please use the formatting described in the FAQ entries on search/replace template and the formatting-your-posts – basically, put the example text in the same kind of text box you used for the macro XML.

        A 1 Reply Last reply Sep 16, 2022, 1:24 PM Reply Quote 1
        • A
          Alan Kilborn @PeterJones
          last edited by Alan Kilborn Sep 16, 2022, 1:25 PM Sep 16, 2022, 1:24 PM

          @PeterJones said in Having trouble getting a macro to work as desired:

          put the example text in the same kind of text box you used for the macro XML

          I was going to add that in my reply, but I suspect OP doesn’t really know how he obtained that nice boxed-in formatting for his macros, so telling him to “do that again” may be pointless. :-)

          But here’s how it happened:

          He copied+pasted full lines from shortcuts.xml and because those lines have leading whitespace, the forum software thinks it is code and puts it in a nice code block.

          Probably any sample text the OP provides would not have that characteristic, and would need manual formatting to get the proper result.

          1 Reply Last reply Reply Quote 2
          3 out of 4
          • First post
            3/4
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors