Macro problem with ctrl + x / ctrl + v
-
I’m trying to make a macro that takes (ctrl + x) a code from a list in tab 1 so look in tab 2 for that same code, copy the line and return to tab 1 and paste.
Tab 1
h03be4be1gcf1ag4d74gb8c0g03b3c73f62aa
h03d68e95gf675g401eg8dd5g0a62b8e4a91e
h03df7a6dgdaa9g40c5g87c0g4e0887602289
h040ae8ebg66eag4e98gb1b1ga42dc42160be
…Tab 2
<content contentuid=“h03be4be1gcf1ag4d74gb8c0g03b3c73f62aa”>You make out one ruined line: ‘the champion must offer a burning stone to the dragon’s mouth.’</content>
<content contentuid=“h03df7a6dgdaa9g40c5g87c0g4e0887602289”>A man’s spirit stands before you, clad in scholarly dress. When your eyes meet, he staggers back, terrified.</content>
<content contentuid=“h037bc53cg9603g4cdbg94c7g190d8dfbbbc8”>As the memory fades, ghostly flames flicker on the surface of the polished sabatons.</content>
…I try to record macro
-shif + end (in code aba1)
-ctrl + x (code)
-ctrl + pgdown (for tab2)
-ctrl + f
-ctrl + v (find the code)
-enter (find the code)
-esc
-Home (code line in tab 2)
-shfit + end
-ctrl + c (copy line from tab 2)
-ctrl + pgdown (return to tab1)
-ctrl + c (paste the tab 2 line in place of the tab 1 line now empty by shift + x)
-down
-Home (to start the cycle again)But what happens is that the macro always only returns the same first line copied from tab 2.
For example
As the first code is h03be4be1gcf1ag4d74gb8c0g03b3c73f62aa the line returned from tab 2 is <content contentuid=“h03be4be1gcf1ag4d74gb8c0g03b3c73f62aa”>You make out one ruined line: ‘the champion must offer a burning stone to the dragon’s mouth.’</content>
For every time the macro is repeatedSorry for my bad english is not my native language
-
Macro operations don’t seem to operate between tabs. If they did, the simplest operation–switching tabs–would work, and it doesn’t seem to. Try this:
- Start macro recording
- Switch from one tab to another
- Stop macro recording
- Replay macro (nothing happens)
It is curious that macro replay is even enabled after stopping macro recording…hmmm…
The recorded macro looks like this:
<Macro name="test" Ctrl="no" Alt="no" Shift="no" Key="0"> <Action type="0" message="2422" wParam="0" lParam="0" sParam="" /> <Action type="0" message="2325" wParam="0" lParam="0" sParam="" /> </Macro>
Here are the definitions of those commands:
- #define SCI_SETSELECTIONMODE 2422
- #define SCI_CANCEL 2325
Doesn’t make a whole lot of sense to me…
-
From what I’ve seen in macro recording, if you click anywhere, Scintilla registers that “I clicked in this Scintilla window to activate that editor” using those two messages (start a selection, then stop selecting).
Fortunately, like many of Notepad++'s GUI commands, it appears that the toggle-view (View > Focus on Another View [F8]) is not macro-recordable, but it is apparently macro-playable as
IDM_VIEW_SWITCHTO_OTHER_VIEW
= 44072<Macro name="changeFocus" Ctrl="no" Alt="no" Shift="no" Key="0"> <Action type="2" message="0" wParam="44072" lParam="0" sParam="" /> </Macro>
So @Noobstein , you might be able to make it work by recording the various pieces of your actions, then edit the
%AppData%\Notepad++\shortcuts.xml
file to merge the pieces, with the<Action type="2" message="0" wParam="44072" lParam="0" sParam="" />
line in between each group. So the actions would be
-
Activate TAB1
-
Start Recording
-
perform the TAB1 actions
-
Stop recording. Save macro as TAB1_ACTIONS
-
Activate TAB2
-
Start Recording
-
perform the TAB2 actions
-
Stop recording. Save macro as TAB2_ACTIONS
-
Exit all instances of Notepad++
-
Edit
%AppData%\Notepad++\shortcuts.xml
-
Start with something like:
<Macro name="TAB1_ACTIONS" Ctrl="no" Alt="no" Shift="no" Key="0"> <Action ...FIRST... /> <Action ... /> </Macro> <Macro name="TAB2_ACTIONS" Ctrl="no" Alt="no" Shift="no" Key="0"> <Action ... /> <Action ...LAST... /> </Macro>
-
Replace with something like:
<Macro name="JOINED_ACTIONS" Ctrl="no" Alt="no" Shift="no" Key="0"> <Action ...FIRST... /> <Action ... /> <Action type="2" message="0" wParam="44072" lParam="0" sParam="" /><!-- toggle view --> <Action ... /> <Action ...LAST... /> </Macro>
-
-
Save
shortcuts.xml
and exit Notepad++ -
Open new Notepad++
-
You should have
JOINED_ACTIONS
in the Macros menu now. It might do what you want.
Using a similar technique, I created a macro which types “First Tab” in the first tab and “Second Tab” in the second tab:
<Macro name="forum" Ctrl="no" Alt="no" Shift="no" Key="0"> <Action type="1" message="2170" wParam="0" lParam="0" sParam="First Tab
" /> <Action type="2" message="0" wParam="44072" lParam="0" sParam="" /> <Action type="1" message="2170" wParam="0" lParam="0" sParam="Second Tab
" /> </Macro>
I verified when I run it, that the two lines are typed in opposite views.
-
-
Good technique.
I don’t know if your posting makes it totally clear enough (especially if one has never opened a second view) that for it to work one tab must be in one view and the other tab must be in the other view. But…it should be clear now. :-)
like many of Notepad++'s GUI commands…is not macro-recordable, but it is apparently macro-playable
Sad that more actions aren’t directly macro-recordable, as that’s probably the only way a non-poweruser can achieve some of these things without having help.
-
Thanks for the answers
It worked by editing %AppData%\Notepad++\ shortcuts.xml and then merging the pieces