Community
    • Login

    Creating a Macro

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    2 Posts 2 Posters 814 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.
    • Gustavo GarciaG
      Gustavo Garcia
      last edited by

      Someone can (please) help me about how to record a macro to extract al lines beginning with $ in a long ASCII file.
      Thanks in advance.

      1 Reply Last reply Reply Quote 0
      • Terry RT
        Terry R
        last edited by

        @Gustavo-Garcia
        The regex (regular expression) for finding and marking those lines would be, using the Find function (with bookmark line also ticked)
        Find What:^\$
        Use Search mode as ‘regular expression’ and tick ‘wrap around’.

        If you did that then you can then use the Search, bookmark submenu to cut or copy these lines to another tab.

        Now a macro is in essence just the steps you take (above) but with first selecting Macro, Start recording. Then you’d type in the regex (as shown above), by first selecting the Mark function, just as you would if using Mark normally. You need to complete by pressing ‘Mark All’, then Close. Remember that once you have completed these steps you would then select Macro, Stop recording. At this point the steps have been recorded, but not yet saved. You then need to select Macro and Save Recorded Macro, give it a name. I would then exit Notepad and re-enter to have it written to an XML file in the Notepad++ environment.

        You will be able to run it again and again by selecting it from the Macro menu.

        Terry

        In my test the macro I created in shortcuts.xml file was:
        <Macro name=“$@start” Ctrl=“no” Alt=“no” Shift=“no” Key=“0”>
        <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=“1702” wParam=“0” lParam=“786” sParam=“” />
        <Action type=“3” message=“1701” wParam=“0” lParam=“1615” sParam=“” />
        </Macro>

        Some of the information can be rather hard to understand, and it’s even harder to edit once created, so if you don’t get it right first time, you will likely need to delete that macro and start again.

        This file can be in several places, for me on Windows 7 it is %appdata%\notepad++. Be careful with opening this file using Notepad++ as it gets written to if required upon exiting Notepad++.

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