Community
    • Login

    shortcuts.xml <Action> tag

    Scheduled Pinned Locked Moved General Discussion
    6 Posts 3 Posters 1.4k 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.
    • SusiKetteS
      SusiKette
      last edited by

      I was unable to find any documentation on editing macros. While the <Macro> tag has pretty self explanatory parameters, I have no idea what most of the parameters in <Action> do. Is there some documentation on these? Or someone who knows what each of them do and what values are accepted.

      “type” seems to define if the action is a character input and “sParam” is the character to input. However, I have no idea what “message”, “wParam” and “lParam” do.

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @SusiKette
        last edited by

        @SusiKette said in shortcuts.xml <Action> tag:

        I was unable to find any documentation on editing macros.

        Where did you look? The official docs at npp-user-manual.org gave a section on the macros in shortcuts.xml, which explains each of those attributes and where to find values

        1 Reply Last reply Reply Quote 2
        • SusiKetteS
          SusiKette
          last edited by

          I was expecting the information to be at “Task automation with macros”, or at the very least have a link to information on how to edit macros. Finding this document, it seems some messages return values, can Notepad++ use them? In other words, can you make conditional macros? Also, some messages take arguments. How do I know whether sParam, wParam or lParam is used for which argument, or is there another way of using them?

          PeterJonesP 2 Replies Last reply Reply Quote 0
          • PeterJonesP
            PeterJones @SusiKette
            last edited by

            @SusiKette said in shortcuts.xml <Action> tag:

            I was expecting the information to be at “Task automation with macros”, or at the very least have a link to information on how to edit macros.

            You mean like the last sentence on that page, where it says:
            30ac1007-3fa5-4553-9d48-ffab76dc3d36-image.png

            Finding this document, it seems some messages return values, can Notepad++ use them?

            It cannot use messages that return values in Macros.

            In other words, can you make conditional macros?

            Nope. There are no variables, loops, or conditionals in Macros. Macros are purely linear.

            For anything more complicated than simple linear macros, you need to either write a plugin; or use one of the many scripting plugins, including PythonScript, NppExec, LuaScript, “jN Notepad++ Plugin” (javascript scripting); or use an external remote-control library, like my “PerlScript”

            How do I know whether sParam, wParam or lParam is used for which argument, or is there another way of using them?

            For Scintilla messages, you look at the Scintilla.iface you already linked, or the Scintilla documentation. For Notepad++ messages, you look at the Notepad++ Plugin Communication doc.

            1 Reply Last reply Reply Quote 1
            • PeterJonesP
              PeterJones @SusiKette
              last edited by

              @SusiKette said in shortcuts.xml <Action> tag:

              sParam, wParam or lParam

              In case I didn’t make a couple of things clear enough:

              1. As the Config Files Details: Macros sectinon says, sParam is just used for Macros; really, the value in sParam is passed to the second (lParam) slot in the actual SendMessage that is run behind the scenes. So sParam is just used for any Notepad++ type=3 message (search/replace syntax) or Scintilla type=1 message that uses a string for the second SendMessage variable.
              2. In the Scintilla.iface that you linked, the StartStyling=2032(position start, int unused) examples show the CamelCase version of the SCI_ Message name, followed by the message ID, and the wParam and lParam variables; any of the variables that it leaves blank are meant to indicate that the particular slot is not used, so should be set to 0: thus, blah=###(x,) means you set lParam to 0 for the SCI_BLAH message.
              1 Reply Last reply Reply Quote 3
              • prahladmifourP
                prahladmifour
                last edited by

                Hello,@SusiKette
                Please try this code, To shortcuts.xml <Action> tag.

                In Windows 7|8|10 C:\Users%username%\AppData\Roaming\Notepad++\shortcuts.xml

                Code:

                <NotepadPlus>
                    <InternalCommands />
                    <Macros>
                        <Macro name="Trim Trailing and save" Ctrl="no" Alt="yes" Shift="yes" Key="83">
                            <Action type="2" message="0" wParam="42024" lParam="0" sParam="" />
                            <Action type="2" message="0" wParam="41006" lParam="0" sParam="" />
                        </Macro>
                        <Macro name="abc" Ctrl="no" Alt="no" Shift="no" Key="0">
                            <Action type="1" message="2170" wParam="0" lParam="0" sParam="a" />
                            <Action type="1" message="2170" wParam="0" lParam="0" sParam="b" />
                            <Action type="1" message="2170" wParam="0" lParam="0" sParam="c" />
                        </Macro>
                    </Macros>
                    <UserDefinedCommands>....
                

                I hope this code will be useful to you.
                Thank you.

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