Running a macro on all the open docs ?.
-
@Alan-Kilborn My System:
Python 3.12.8 (tags/v3.12.8:2dc476b, Dec 3 2024, 19:30:04) [MSC v.1942 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> PythonScript_Full_3.0.18.0(1).zip Notepad++ V8.7.5 (64-bit) Device name DESKTOP-14FSQB0 Processor AMD Ryzen 5 3600 6-Core Processor 3.59 GHz Installed RAM 16.0 GB Device ID 286AD617-B3F1-4D02-88D1-05EFCBA6CE74 Product ID 00325-80455-52714-AAOEM System type 64-bit operating system, x64-based processor Pen and touch No pen or touch input is available for this display
My ERROR:
Traceback (most recent call last): File "C:\Users\jrdie\AppData\Roaming\Notepad++\plugins\Config\PythonScript\scripts\MACROonALL.py", line 18, in <module> notepad.activateIndex(v, docIndexes[v]) OverflowError: Python int too large to convert to C long
-
@PeterJones said in Running a macro on all the open docs ?.:
Are you sure the macro works correctly when you run it once on an open file? Does your macro open a windows command?
Yes, it works fine and does not open any windows.
-
Finally, a modicum of information. However, the full ?-menu’s Debug Info would have been even more helpful.
I’m not sure why you are using PythonScript 3.0.18, instead of 3.0.22, but I will use the exact version of PythonScript that you claim to be using
For my experiments, I have a macro called
DoNothing
, which is literally,<Macro name="DoNothing" Ctrl="no" Alt="no" Shift="no" Key="0"> <Action type="0" message="2172" wParam="0" lParam="0" sParam="" /> </Macro>
It does nothing, but it will verify that the script will run, which is what we are trying to do.
Unfortunately for you, I still cannot replicate your error.
PythonScript 3.0.18
When I open the PythonScript Console with 3.0.18, I see,
Python 3.12.3 (tags/v3.12.3:f6650f9, Apr 9 2024, 14:05:25) [MSC v.1938 64 bit (AMD64)]
This does not match yours: PS3.0.18 comes with Python 3.12.3, which is older than the Python 3.12.8 that your information claims. So now I have to conclude you were incorrect when you said you were using
PythonScript_Full_3.0.18.0(1).zip
, and now I have to guess what version you’re really using.Please TRY to be more precise in the information you give. When you give us WRONG information, it’s as bad or worse than MISSING information. It is very hard to help you when you give answers like that. This is why I want to give up helping you, because your responses are making it as hard as possible for me to help you.
But before I moved on, I tried an exact copy of the Script I posted above, and it gave no error message with Notepad++ v8.7.5 (64-bit) and PythonScript 3.0.18, and ran just fine. So so far, I cannot replicate your problem.
PythonScript 3.0.22:
So next I tried guessing PythonScript 3.0.22: That says,
Python 3.12.9 (tags/v3.12.9:fdb8142, Feb 4 2025, 15:27:58) [MSC v.1942 64 bit (AMD64)]
which is newer than what your information claims. This is an annoyingly frustrating process, which would have been avoided if you had given CORRECT information about your setup.
But I used the same script and macro, and still got no error message, and the script ran just fine.
PythonScript 3.0.21:
Next guess: 3.0.21:
Python 3.12.8 (tags/v3.12.8:2dc476b, Dec 3 2024, 19:30:04) [MSC v.1942 64 bit (AMD64)]
Other than the
on win32
that you have, this string matches what you have… so hopefully I’ve replicated your setup at this point.When I run the script, I get no error message, and no windows pop up.
Here is my final setup’s information:
Notepad++ v8.7.5 (64-bit) Build time : Dec 21 2024 - 05:13:03 Path : C:\usr\local\apps\npp\npp.8.7.5.x64.PS3\notepad++.exe Command Line : Admin mode : OFF Local Conf mode : ON Cloud Config : OFF Periodic Backup : ON Placeholders : OFF DirectWrite : ON Multi-instance Mode : monoInst File Status Auto-Detection : cdEnabledNew (for current file/tab only) Dark Mode : OFF OS Name : Windows 11 Home (64-bit) OS Version : 24H2 OS Build : 26100.3476 Current ANSI codepage : 1252 Plugins : mimeTools (3.1) NppConverter (4.6) NppExport (0.4) PythonScript (3.0.21)
I have exhausted everything I can try at this point. Share your ?-menu’s Debug Info. Share your macro definition from the
C:\Users\jrdie\AppData\Roaming\Notepad++\shortcuts.xml
. Share the exact contents ofC:\Users\jrdie\AppData\Roaming\Notepad++\plugins\Config\PythonScript\scripts\MACROonALL.py
after you edited it.Without all that information, I cannot help you. If you skip any of it, I will assume you don’t want anyone’s help anymore.
-
@PeterJones To tell you what version I am using is difficult since I have spend most of today uninstalling and reinstalling versions of Python, PythonScript and Notpad++. tried 3.0.22 as well.
8.7.5 at the moment, but tried 8.7.9 as well.
Notepad++ v8.7.5 (64-bit)
Build time : Dec 21 2024 - 05:13:03
Path : C:\Program Files\Notepad++\notepad++.exe
Command Line :
Admin mode : OFF
Local Conf mode : OFF
Cloud Config : OFF
Periodic Backup : ON
Placeholders : OFF
DirectWrite : ON
Multi-instance Mode : monoInst
File Status Auto-Detection : cdEnabledNew (for current file/tab only)
Dark Mode : OFF
OS Name : Windows 10 Home (64-bit)
OS Version : 22H2
OS Build : 19045.5679
Current ANSI codepage : 1252
Plugins :
mimeTools (3.1)
NppConverter (4.6)
NppExport (0.4)
I am starting again now with a uninstall/re-install.
I think I am getting better at that at least.Back to my desire to get this to work, I load 66 books into Notepad++ and run a small number of MACROs on all. I can just do this manually.
I will send you the outcome when done.
Thanx again
After that I feel bad taking any more of you time. Thanx. -
@Robert-Or-Janet-Diebel said in Running a macro on all the open docs ?.:
Plugins :
mimeTools (3.1)
NppConverter (4.6)
NppExport (0.4)
I am starting again now with a uninstall/re-install.There isn’t even a PythonScript in the list.
I think we’re being trolled.
-
@Robert-Or-Janet-Diebel said in Running a macro on all the open docs ?.:
To tell you what version I am using is difficult since I have spend most of today uninstalling and reinstalling versions of Python, PythonScript and Notpad++. tried 3.0.22 as well.
Once you’ve realized that you don’t know what you’re doing, and have asked for help, it’s a good idea to follow the advice given, so that you can make use of the help that people have given you.
As @Alan-Kilborn says, the Debug Info you showed didn’t include any PythonScript. The whole point of my asking for the Debug Info was so that I could try to replicate the exact setup you had when you were getting the error. But you apparently don’t want help.
I am starting again now with a uninstall/re-install.
Completely unnecessary, and a waste of your time.
I will send you the outcome when done.
Since you’re not trying what I suggested, nor giving me the information necessary to help you, I find it highly unlikely that you’re going to get any different outcome.
As I said, until you are willing to actually give all the information I asked for in my previous post, I cannot help you. Hopefully that conclusion that you’re a trolling is wrong – but the only way you could prove otherwise at this point would be to finally follow all the steps that you’ve been asked to, reporting back on exact conditions that cause the problem.
-
@PeterJones I do not know what is ment by being trolled, but it sounds dishonest, which I am not.
I am sorry to have bothered you.
I will continue going over the help you have provided hoping to figure out what I am doing wrong.
Thanx again. -
@Alan-Kilborn said earlier:
… think it is a bug in the PythonScript plugin.
Stay tuned, more detail to come…Here’s the PS bug report: https://github.com/bruderstein/PythonScript/issues/382
-
My latest attempt.
# encoding=utf-8 """in response to https://community.notepad-plus-plus.org/topic/21663/ Run a macro on each open file """ from Npp import notepad # store active tab in each View keepBufferID = notepad.getCurrentBufferID() docIndexes = [notepad.getCurrentDocIndex(v) for v in range(2)] for filename, bufferID, index, view in notepad.getFiles(): notepad.activateBufferID(bufferID) notepad.runMenuCommand("Macro", "\c2Book\v2Verse") # restore active tab in each View for v in range(2): notepad.activateIndex(v, docIndexes[v]) notepad.activateBufferID(keepBufferID) Notepad++ v8.7.5 (64-bit) Build time : Dec 21 2024 - 05:13:03 Path : C:\Program Files\Notepad++\notepad++.exe Command Line : Admin mode : OFF Local Conf mode : OFF Cloud Config : OFF Periodic Backup : ON Placeholders : OFF DirectWrite : ON Multi-instance Mode : monoInst File Status Auto-Detection : cdEnabledNew (for current file/tab only) Dark Mode : OFF OS Name : Windows 10 Home (64-bit) OS Version : 22H2 OS Build : 19045.5679 Current ANSI codepage : 1252 Plugins : mimeTools (3.1) NppConverter (4.6) NppExport (0.4) PythonScript (2) Python 2.7.18 (v2.7.18:8d21aa21f2, Apr 20 2020, 13:25:05) [MSC v.1500 64 bit (AMD64)] Initialisation took 62ms Ready. Traceback (most recent call last): File "C:\Users\jrdie\AppData\Roaming\Notepad++\plugins\Config\PythonScript\scripts\MACROonALL.py", line 17, in <module> notepad.activateIndex(v, docIndexes[v]) OverflowError: Python int too large to convert to C long
–
moderator fixed your markdown. You have successfully done the text boxes before, so you know how to make it work. please pay more attention in the future. -
R Robert Or Janet Diebel referenced this topic on
-
@Alan-Kilborn running PythonScript 2 I can at least get an error in the console.
Running PythonScript 3 it comes up incompatible.
I tried Notepad++ 8.7.5, and 8.7.9. -
Notepad++ v8.7.9 (64-bit) Build time : Mar 26 2025 - 03:20:28 Scintilla/Lexilla included : 5.5.5/5.4.3 Boost Regex included : 1_85 Path : C:\Program Files\Notepad++\notepad++.exe Command Line : Admin mode : OFF Local Conf mode : OFF Cloud Config : OFF Periodic Backup : ON Placeholders : OFF Scintilla Rendering Mode : SC_TECHNOLOGY_DIRECTWRITE (1) Multi-instance Mode : monoInst File Status Auto-Detection : cdEnabledNew (for current file/tab only) Dark Mode : OFF OS Name : Windows 10 Home (64-bit) OS Version : 22H2 OS Build : 19045.5679 Current ANSI codepage : 1252 Plugins : mimeTools (3.1) NppConverter (4.6) NppExport (0.4)
–
moderator fixed your markdown. you used to get the text boxes right; why have you stopped? -
@Alan-Kilborn My MACRO:
<?xml version="1.0" encoding="UTF-8" ?> <NotepadPlus> <InternalCommands /> <Macros> <Macro name="Trim Trailing Space 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="\c2Book\v2Verse" Ctrl="no" Alt="no" Shift="no" Key="0"> <Action type="2" message="0" wParam="42083" lParam="0" sParam="" /> <Action type="3" message="1700" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1601" wParam="0" lParam="0" sParam="(?-s)^\\c (\d+)(?=(.*\R)+?\\toc2 (.+)$)" /> <Action type="3" message="1625" wParam="0" lParam="2" sParam="" /> <Action type="3" message="1602" wParam="0" lParam="0" sParam="${3} ${1}" /> <Action type="3" message="1702" wParam="0" lParam="512" sParam="" /> <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" /> <Action type="3" message="1700" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1601" wParam="0" lParam="0" sParam="(?-is)\\v (?=(?s:.+?^(\u[\u\l -]+ \d+$)))" /> <Action type="3" message="1625" wParam="0" lParam="2" sParam="" /> <Action type="3" message="1602" wParam="0" lParam="0" sParam="${1}:" /> <Action type="3" message="1702" wParam="0" lParam="512" sParam="" /> <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" /> <Action type="2" message="0" wParam="42083" lParam="0" sParam="" /> </Macro> <Macro name="RemoveUSFM" 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="\\f.*?\\f\*" /> <Action type="3" message="1625" wParam="0" lParam="2" sParam="" /> <Action type="3" message="1602" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1702" wParam="0" lParam="770" sParam="" /> <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" /> <Action type="3" message="1700" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1601" wParam="0" lParam="0" sParam="\\fig.*?\\fig\*" /> <Action type="3" message="1625" wParam="0" lParam="2" sParam="" /> <Action type="3" message="1602" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1702" wParam="0" lParam="770" sParam="" /> <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" /> <Action type="3" message="1700" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1601" wParam="0" lParam="0" sParam="\\x.*?\\x\*" /> <Action type="3" message="1625" wParam="0" lParam="2" sParam="" /> <Action type="3" message="1602" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1702" wParam="0" lParam="770" sParam="" /> <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" /> <Action type="3" message="1700" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1601" wParam="0" lParam="0" sParam="\r\n\\s2.*$|\r\n\\s1.*$|\r\n\\s.*$" /> <Action type="3" message="1625" wParam="0" lParam="2" sParam="" /> <Action type="3" message="1602" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1702" wParam="0" lParam="770" sParam="" /> <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" /> <Action type="3" message="1700" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1601" wParam="0" lParam="0" sParam="\r\n\\ms1.*$|\r\n\\r.*$" /> <Action type="3" message="1625" wParam="0" lParam="2" sParam="" /> <Action type="3" message="1602" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1702" wParam="0" lParam="770" sParam="" /> <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" /> <Action type="3" message="1700" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1601" wParam="0" lParam="0" sParam="\\\+nd\*|\\\+nd\s|\\nd\*|\\nd\s|\\k\*|\\k\s" /> <Action type="3" message="1625" wParam="0" lParam="2" sParam="" /> <Action type="3" message="1602" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1702" wParam="0" lParam="770" sParam="" /> <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" /> <Action type="3" message="1700" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1601" wParam="0" lParam="0" sParam="\\\+tl\*|\\\+tl\s|\\tl\*|\\tl\s" /> <Action type="3" message="1625" wParam="0" lParam="2" sParam="" /> <Action type="3" message="1602" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1702" wParam="0" lParam="770" sParam="" /> <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" /> <Action type="3" message="1700" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1601" wParam="0" lParam="0" sParam="\\qs\*|\\qs\s" /> <Action type="3" message="1625" wParam="0" lParam="2" sParam="" /> <Action type="3" message="1602" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1702" wParam="0" lParam="770" sParam="" /> <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" /> <Action type="3" message="1700" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1601" wParam="0" lParam="0" sParam="\r\n\\m|\r\n\\p|\r\n\\b" /> <Action type="3" message="1625" wParam="0" lParam="2" sParam="" /> <Action type="3" message="1602" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1702" wParam="0" lParam="770" sParam="" /> <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" /> <Action type="3" message="1700" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1601" wParam="0" lParam="0" sParam="\r\n\\q4|\r\n\\q3" /> <Action type="3" message="1625" wParam="0" lParam="2" sParam="" /> <Action type="3" message="1602" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1702" wParam="0" lParam="770" sParam="" /> <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" /> <Action type="3" message="1700" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1601" wParam="0" lParam="0" sParam="\r\n\\q2|\r\n\\q1|\r\n\\q" /> <Action type="3" message="1625" wParam="0" lParam="2" sParam="" /> <Action type="3" message="1602" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1702" wParam="0" lParam="770" sParam="" /> <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" /> <Action type="3" message="1700" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1601" wParam="0" lParam="0" sParam="\\add\*" /> <Action type="3" message="1625" wParam="0" lParam="2" sParam="" /> <Action type="3" message="1602" wParam="0" lParam="0" sParam="]" /> <Action type="3" message="1702" wParam="0" lParam="770" sParam="" /> <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" /> <Action type="3" message="1700" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1601" wParam="0" lParam="0" sParam="\\add\s" /> <Action type="3" message="1625" wParam="0" lParam="2" sParam="" /> <Action type="3" message="1602" wParam="0" lParam="0" sParam="[" /> <Action type="3" message="1702" wParam="0" lParam="770" sParam="" /> <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" /> <Action type="3" message="1700" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1601" wParam="0" lParam="0" sParam="\\png\*|\\png\s" /> <Action type="3" message="1625" wParam="0" lParam="2" sParam="" /> <Action type="3" message="1602" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1702" wParam="0" lParam="770" sParam="" /> <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" /> <Action type="3" message="1700" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1601" wParam="0" lParam="0" sParam="\\pn\*|\\pn\s" /> <Action type="3" message="1625" wParam="0" lParam="2" sParam="" /> <Action type="3" message="1602" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1702" wParam="0" lParam="770" sParam="" /> <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" /> <Action type="3" message="1700" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1601" wParam="0" lParam="0" sParam="\r\n\\d\s" /> <Action type="3" message="1625" wParam="0" lParam="2" sParam="" /> <Action type="3" message="1602" wParam="0" lParam="0" sParam=" " /> <Action type="3" message="1702" wParam="0" lParam="770" sParam="" /> <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" /> </Macro> <Macro name="RemovePreamble" 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="\\id\s.*^(\w+\s1)$" /> <Action type="3" message="1625" wParam="0" lParam="2" sParam="" /> <Action type="3" message="1602" wParam="0" lParam="0" sParam="${1}" /> <Action type="3" message="1702" wParam="0" lParam="1536" sParam="" /> <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" /> </Macro> <Macro name="RemovePreamble2" 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="(?s-i)\\id.+?\\toc2 (.+?)\R.*?(?=^\1 \d+$)" /> <Action type="3" message="1625" wParam="0" lParam="2" sParam="" /> <Action type="3" message="1602" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1702" wParam="0" lParam="512" sParam="" /> <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" /> </Macro> <Macro name="Space2Tab" 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="^(\w+\s\d+:\d+)\s(.*)$" /> <Action type="3" message="1625" wParam="0" lParam="2" sParam="" /> <Action type="3" message="1602" wParam="0" lParam="0" sParam="$1\t$2" /> <Action type="3" message="1702" wParam="0" lParam="512" sParam="" /> <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" /> </Macro> </Macros> <UserDefinedCommands> <Command name="Get PHP help" Ctrl="no" Alt="yes" Shift="no" Key="112">https://www.php.net/$(CURRENT_WORD)</Command> <Command name="Wikipedia Search" Ctrl="no" Alt="yes" Shift="no" Key="114">https://en.wikipedia.org/wiki/Special:Search?search=$(CURRENT_WORD)</Command> <Command name="Open selected file path in new instance" Ctrl="no" Alt="yes" Shift="no" Key="117">$(NPP_FULL_FILE_PATH) $(CURRENT_WORD) -nosession -multiInst</Command> </UserDefinedCommands> <PluginCommands /> <ScintillaKeys /> </NotepadPlus>
-
@Robert-Or-Janet-Diebel said in Running a macro on all the open docs ?.:
<Macro name="\c2Book\v2Verse" ...
Why in the world would you put backslashes into the name of a macro?!?! You obviously know that backslashes are important to regex, because your macros include regex with backslashes! It turns out, and they are also important in lots of other things, including programming language strings.
I know that’s not the cause of your imagined “incompatibility” between Notepad++ v8.7.5 (or newer) and PythonScript 3… but it does appear to be the culprit for your other difficulties, when you do have a working combination of Notepad++ and PythonScript 2.
Despite your lack of ability to correctly install it, PythonScript 3.0.22 works just fine with v8.7.9 and v8.7.5. My Experiments with PythonScript 3.0.22 with v8.7.9 show that calling
notepad.runMenuCommand("Macro", "\c2Book\v2Verse")
causes an error, specifically,C:\usr\local\apps\npp\npp.8.7.9.portable.x64-withPS3022\plugins\Config\PythonScript\scripts\MacroAllFiles_BadBackslash.py:13: SyntaxWarning: invalid escape sequence '\c' notepad.runMenuCommand("Macro", "\c2Book\v2Verse")
When using
notepad.runMenuCommand("Macro", "\\c2Book\\v2Verse")
in the script, it works. If we had known that you had backslashes in your macro name earlier in the process, we could have warned you about that issue, and you wouldn’t have had any difficulty once you got PythonScript installed properlyI’m going to give up trying to help you install PythonScript 3, even though I know it works just fine. Instead, just use Plugins Admin to install the most recent PythonScript 2 (right now, it’s 2.1.0 in the Plugins Admin; I don’t know why you installed 2.0 instead). With that, and using the modified string in
notepad.runMenuCommand("Macro", "\\c2Book\\v2Verse")
, the script will work for you (or, if you rename your macro so it doesn’t have backslashes, then you can just use the literal name of the macro in the string) -
@PeterJones Thank you. I will change and try again.
-
@PeterJones I appreciate all your efforts. After a very thorough remove, cleanup and re-install of both Notepad++ and PythonScript My initial tests show it is working. Thanx
-
@Alan-Kilborn I appreciate all your efforts. After a very thorough remove, cleanup and re-install of both Notepad++ and PythonScript My initial tests show it is working. Thanx
-
@Alan-Kilborn Some “Scope Creep” I know, but could I get your input on if and how this might be possible?
I load *.SFM files from an SFM folder.
I run my MACROs on them.
I wish to SAVE ALL with a different extention *.txt to a differnt (TXT) folder.
I can “save as” with extention changed manually.
But I thought it might be do-able in a more automated way.
As always, all help much appreciated. -
@Robert-Or-Janet-Diebel said :
could I get your input on…
You’d have to go full-on scripting to achieve that; can’t be done in a macro, but easily doable with scripting. If you go that route, perhaps it makes sense to translate your macro into script commands as well.
-
@Alan-Kilborn said in Running a macro on all the open docs ?.:
@Robert-Or-Janet-Diebel said :
could I get your input on…
You’d have to go full-on scripting to achieve that;
@Robert-Or-Janet-Diebel, since you are now using my script to run the macro on every file anyway, adding the calculation to get the new filename based on the old .txt name shouldn’t be difficult, and that could be passed into
notepad.saveAs()
– these lines would go immediately after thenotepad.runMenuCommand(...)
line, at the same indentation level.If you go that route, perhaps it makes sense to translate your macro into script commands as well.
it probably does make sense to translate the two search-and-replaces from the macro into native pythonscript. if I’d known, at the time I was writing that script, that the macro just did one or two s+r actions, I would have asked what those regex were specifically, and we could have bypassed the whole macro-naming fiasco by running the macro in the PythonScript.
But I’m not sure I’m interested in being the one to add the filename calculation, or substitue the
notepad.runMenuCommand(...)
with theeditor.research(...)
or walk @Robert-Or-Janet-Diebel through the process of typing in those lines into the correct place in the script, because I have a feeling that would be another huge number of back-and-forths. -
@PeterJones Well, what you have helped me with previously is working great. and I thank you very much. It is good to know it is possible though.