Skip to content

Commit 16d083e

Browse files
authored
fix example macro in the SubFAQ
1 parent 67dd71e commit 16d083e

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

CommunityForum/FAQ/AutomatingNotepadPlusPlus.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,22 +93,23 @@ Let's assume that you want to have a macro that will **Select All**, then **Plug
9393
- It would start out as something like this:
9494
```
9595
<Macro name="RecordedMacro" Ctrl="no" Alt="no" Shift="no" Key="0">
96-
<Action type="2" message="0" wParam="42007" lParam="0" sParam="0" />
97-
<Action type="2" message="0" wParam="42007" lParam="0" sParam="0" />
98-
<Action type="2" message="0" wParam="42002" lParam="0" sParam="0" />
96+
<Action type="0" message="2013" wParam="0" lParam="0" sParam="" />
97+
<Action type="0" message="2013" wParam="0" lParam="0" sParam="" />
98+
<Action type="0" message="2178" wParam="0" lParam="0" sParam="" />
9999
</Macro>
100100
```
101101
That is the **Select All** command twice and the copy (skipping the plugin command between the two **Select All**.
102102
- You would need to edit it to be like:
103103
```
104104
<Macro name="RecordedMacro" Ctrl="no" Alt="no" Shift="no" Key="0">
105-
<Action type="2" message="0" wParam="42007" lParam="0" sParam="0" />
105+
<Action type="0" message="2013" wParam="0" lParam="0" sParam="" />
106106
<Action type="2" message="0" wParam="22064" lParam="0" sParam="0" />
107-
<Action type="2" message="0" wParam="42007" lParam="0" sParam="0" />
108-
<Action type="2" message="0" wParam="42002" lParam="0" sParam="0" />
107+
<Action type="0" message="2013" wParam="0" lParam="0" sParam="" />
108+
<Action type="0" message="2178" wParam="0" lParam="0" sParam="" />
109109
</Macro>
110110
```
111111
which puts the `22064` that I found with NppUISpy in between the two **Select All** instances.
112+
- Please note that many recorded editor commands (like copy, paste, home, etc) will be `type="0"` with the scintilla command in the `message="..."` field; whereas menu commands like the plugin command will be `type="2"` and put the menuCommandID into the `wParam="###"` field. See the [user manual's `<Macro><Action>` details](https://npp-user-manual.org/docs/config-files/#attributes-for-the-action-tag) for more.
112113
- Save the `shortcuts.xml` and restart Notepad++.
113114
114115
At this point, running your macro should do the select all, the conversion, the select all, and the copy.

0 commit comments

Comments
 (0)