Running a macro on all the open docs ?.
-
@Robert-Or-Janet-Diebel said in Running a macro on all the open docs ?.:
When I run it a very quick window flashes up with no time to see any output, or errors.
Are you sure the macro works correctly when you run it once on an open file? Does your macro open a windows command?
Because the with the script I gave you, the PythonScript plugin itself should not be opening any windows, but should just be running the macro
Are you running the script with the PythonScript plugin, or are you trying to run the
blah.py
file with an externalpython.exe
instance? If the latter, you are doing it wrong, and need to read the FAQ I linked you to again.If this isn’t enough for you to debug what’s going wrong, you need to tell us the exact steps you took to install the script and run the script.
-
Sorry, I didn’t see this part of the post when I first replied.
@Robert-Or-Janet-Diebel said in Running a macro on all the open docs ?.:
When I open The console I try to paste the program, that does not work.
The FAQ does not say to paste the program into the PythonScript console. Please read the FAQ again.
-
@PeterJones I have input a MACRO name that works on individual files in Notepad++.
I have it in a file and run it from there, but the files do not change when I run this by clicking on the file name in its folder. That is when the window pops up and disappears.
I try to run it from the console but cannot paste it in, or type.
Sorry, I am missing something here. -
@PeterJones OK, Thanx
-
@Robert-Or-Janet-Diebel said in Running a macro on all the open docs ?.:
when I run this by clicking on the file name in its folder.
The FAQ does not say to run the script from Windows Explorer. It says to run it using the Plugins > PythonScript > scripts >
scriptname
menu command.Have you read the FAQ I linked to? Because it doesn’t appear that you have.
-
@PeterJones This does not work. Fearing I made a mistake installing, I tried to remove the plugin and re-install. It will not remove. It remains in installed, and not available.
-
@PeterJones I have read the FAQ
-
@PeterJones My Python:```
Python 3.13.2 (tags/v3.13.2:4f8bb39, Feb 4 2025, 15:23:48) [MSC v.1942 64 bit (AMD64)] on win32PythonScript is 2.1.0.0 From FAQ I would remove PythonScript 2, and install 3. But it will not remove from the plugin admin.
-
@PeterJones Now I see this come up in the console:
Python 2.7.18 (v2.7.18:8d21aa21f2, Apr 20 2020, 13:25:05) [MSC v.1500 64 bit (AMD64)] Initialisation took 62ms Ready.
I really am lost here.
-
I really am lost here.
It looks like you uninstalled the PythonScript 3 that you previously had installed manually, and replaced it using PythonScript 2 in the Plugins admin. I would not have recommended that.
To re-install PythonScript 3 again:
- Close all instances of Notepad++
- Go to
C:\Program Files\Notepad++\Plugins\
(or your Plugins directory for wherever Notepad++ is installed) and delete thePythonScript
directory - Follow the instructions in the PythonScript 3 section of the installing-pythonscript in the FAQ (the link takes you to the right line of the FAQ, with the text highlighted, in most browsers), making sure to grab PythonScript_Full_3.0.22.0_x64_PluginAdmin.zip
After PythonScript 3 is installed, the PythonScript console should go back to telling you
Python 3.12.8 (tags/v3.12.8:2dc476b, Dec 3 2024, 19:30:04) [MSC v.1942 64 bit (AMD64)]
Then move on to the step 2 in the FAQ: create a new scropt, and follow those instructions to create the empty version of the script.
Next continue with step 3 of the FAQ: copy the script from my post and paste it in the new file. tTo avoid forgetting it later, at this point, please edit the script to say your macro’s name instead of
DoNothing
, and then save the script.Skip step 4 for now, because you don’t want to confuse yourself with trying to do too much.
Then move down to the Usage section of the FAQ, and read that whole section. Once you are done reading that section, you should understand that the last bullet point explains how to run your script if you don’t have a keyboard shortcut (which you shouldn’t, at this point).
-
@PeterJones 
-
I assumed you had 64bit Notepad++. If you are using 32bit Notepad++, you will have to grab the appropriate PythonScript download. If you do have 64bit Notepad++, then you have done something wrong, though I cannot guess what it might have been.
-
@Alan-Kilborn said earlier:
…The active tab is cloned and the view 1 cloned tab is active when the script is run – what happens here is that when the script has finished executing, the view 0 clone’s tab is left as the active one. I believe this is actually a bug in Notepad++
I’ve changed my mind on this a bit; I now think it is a bug in the PythonScript plugin.
Stay tuned, more detail to come… -
@Alan-Kilborn what version of Notepad++ is OK. What version of Python. and PythonScript?
Thanx for your help. I have tried a number of things. -
Peter is helping you. I don’t want to dive in and muddle the conversation. Peter will be back to provide you with more help, although I’m not sure why you’d need it. It should all be really straightforward if you just pay attention to his instruction.
-
@Alan-Kilborn said in Running a macro on all the open docs ?.:
although I’m not sure why you’d need it
Nor am I.
Peter will be back to provide you with more help,
The problem is, Peter is out of ideas, and since @Robert-Or-Janet-Diebel hasn’t provided any more meaningful information, and just makes vague assertions about trying multiple things, I don’t believe I can help anymore. Maybe you can figure out the right things to ask so that they’ll answer meaningfully and progress can be made. Good luck.
-
@PeterJones Sorry you see it that way. I thought a clear error about the incompatibility, and a question about versions that would work together was something you might be able to help me with.
The “number of things” I did was different versions I hoped would work together.
“PythonScript_Full_3.0.22.0_x64_PluginAdmin.zip” as you suggested, and an update to Notepad++, and tried different Python.
I am not sure I can do much else but blow everything away, and start again.
Regardless, I very much appreciate the help you have offered thus far. Thanx. -
@PeterJones After re-install at least the console comes up with an 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
-
@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.