Macro problem
-
Hello, All,
I need your help for a macro problem !
On my portable
v8.9release of N++, I installed three pluginsComparePlus,Columns++andNppUISpyI have two files, one in each N++ view .
- In the main view, I have a list of regexes, in a
txtfile, in order to count the number of chars of any Unicode block. For instance :
[\x{0000}-\x{007F}] | 128 | Basic Latin [\x{0080}-\x{00FF}] | 128 | Latin-1 Supplement [\x{0100}-\x{017F}] | | Latin Extended-A [\x{0180}-\x{024F}] | | Latin Extended-B [\x{0250}-\x{02AF}] | | IPA Extensions [\x{02B0}-\x{02FF}] | | Spacing Modifier Letters ... ...- In the secondary view, I have the
Total_Chars.txtfile, in N++ read-only mode, which contains all Unicode characters, minus the empty Unicode planes and few other zones
So my goal is :
-
First, I select a regex, in the main view
-
Then, the macro :
-
Do the
Copyaction -
Switch from main to secondary view
-
Open the Search dialog of the
Columns++plugin -
Do the
Pasteaction within the plugin dialog
-
Here are the contents of this macro :
<Macro name="Blocks" Ctrl="no" Alt="no" Shift="no" Key="0"> <Action type="0" message="2178" wParam="0" lParam="0" sParam=""/> <Action type="2" message="0" wParam="44072" lParam="0" sParam=""/> <Action type="2" message="0" wParam="22061" lParam="0" sParam=""/> <Action type="0" message="2179" wParam="0" lParam="0" sParam=""/> </Macro>However, the
Pasteaction does not occur and the search zone of the plugin is not updated with the clipboard contents :-((I also wanted, if possible, to get the total of chars, by hitting the
Alt + Tshortcut, within the Search dialog of the pluginIs there a mean to achieve such a goal ?
TIA !
Best Regards,
guy038
P.S. :
Of course, the paste action is not allowed within the
Total_Chars.txtfile which is a read-only file !But, when I added a new tab in the secondary view, it does paste the text in this new tab, and NOT within the
Find whatfield of theColumns++plugin ! - In the main view, I have a list of regexes, in a
-
@guy038
Yeah, macros can’t interact with plugin dialogs - that’s a Notepad++ limitation.MultiReplace might work as an alternative
What it can do: Instead of counting one regex at a time via a macro loop, MultiReplace lets you run all your regexes against the file in a single “Find All” operation, No macro gymnastics needed.
Here’s the quick rundown:
- Open MultiReplace, right-click list header → enable “Find Count”
- Add your regexes (with Regex checkbox enabled), or import via CSV:
Selected,Find,Replace,WholeWord,MatchCase,UseVariables,Extended,Regex,Comments 1,"[\x{0000}-\x{007F}]","",0,0,0,0,1,Basic Latin 1,"[\x{0080}-\x{00FF}]","",0,0,0,0,1,Latin-1 Supplement- Open
Total_Chars.txt, click “Find All”
The Find Count column shows all matches at once. Works with read-only files.
The catch: it’s batch, not interactive. And the counts aren’t in CSV export yet - you’d copy them manually. (That feature is on my list right now.)
Cheers
-
https://www.scintilla.org/ScintillaDoc.html#SCI_COPY
copying data to the clipboard
Is document to the clipboard.
https://www.scintilla.org/ScintillaDoc.html#SCI_PASTE
pasting from the clipboard into the document
Is clipboard to the document.
Both functions relate to the document in the editor. The copy function will be good for the task though paste will not work with the search window.
Instead of
SCI_PASTE, could use the Run command to run an executable to insert the clipboard text into the search window.AutoIt3 script
automate_columns++_search.au3:; Wait up to 3 seconds for the window. $hSearch = WinWait('Search in indicated region', '', 3) If $hSearch Then $sClip = ClipGet() ; get clipboard text ControlSetText($hSearch, '', 'Edit1', $sClip) ; set combo edit ControlClick($hSearch, '', 'Button7') ; click regex button ControlClick($hSearch, '', 'Button9') ; click count button $sCount = ControlGetText($hSearch, '', 'Static3') ; read label ClipPut($sCount) ; set clipboard text EndIfAdjust the title if the window text is localized.
Compile to executable and then add to Run as a command. Get the command id with
NppUISpyand insert into theshortcuts.xmlfile.