• Login
Community
  • Login

Running a macro on all the open docs ?.

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
51 Posts 4 Posters 1.2k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R
    Robert Or Janet Diebel @PeterJones
    last edited by Apr 5, 2025, 7:28 PM

    @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.

    1 Reply Last reply Reply Quote 0
    • R
      Robert Or Janet Diebel @PeterJones
      last edited by Apr 5, 2025, 7:29 PM

      @PeterJones I have read the FAQ

      P 1 Reply Last reply Apr 5, 2025, 8:38 PM Reply Quote 0
      • R
        Robert Or Janet Diebel @PeterJones
        last edited by Apr 5, 2025, 7:50 PM

        @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 win32

        PythonScript is 2.1.0.0
        From FAQ I would remove PythonScript 2, and install 3. But it will not remove from the plugin admin.
        1 Reply Last reply Reply Quote 0
        • R
          Robert Or Janet Diebel @PeterJones
          last edited by Apr 5, 2025, 8:02 PM

          @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.

          1 Reply Last reply Reply Quote 0
          • P
            PeterJones @Robert Or Janet Diebel
            last edited by PeterJones Apr 5, 2025, 8:39 PM Apr 5, 2025, 8:38 PM

            @Robert-Or-Janet-Diebel ,

            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:

            1. Close all instances of Notepad++
            2. Go to C:\Program Files\Notepad++\Plugins\ (or your Plugins directory for wherever Notepad++ is installed) and delete the PythonScript directory
            3. 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).

            R 1 Reply Last reply Apr 6, 2025, 12:40 AM Reply Quote 1
            • R
              Robert Or Janet Diebel @PeterJones
              last edited by Apr 6, 2025, 12:40 AM

              @PeterJones ![alt text](c4b5dce7-4030-4246-a5d6-378ea3ba34d4-image.png image url)

              P 1 Reply Last reply Apr 6, 2025, 12:55 AM Reply Quote 0
              • P
                PeterJones @Robert Or Janet Diebel
                last edited by Apr 6, 2025, 12:55 AM

                @Robert-Or-Janet-Diebel ,

                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.

                1 Reply Last reply Reply Quote 1
                • A
                  Alan Kilborn @Alan Kilborn
                  last edited by Apr 6, 2025, 12:05 PM

                  @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…

                  R A 2 Replies Last reply Apr 6, 2025, 12:41 PM Reply Quote 0
                  • R
                    Robert Or Janet Diebel @Alan Kilborn
                    last edited by Apr 6, 2025, 12:41 PM

                    @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.

                    A 1 Reply Last reply Apr 6, 2025, 1:04 PM Reply Quote 0
                    • A
                      Alan Kilborn @Robert Or Janet Diebel
                      last edited by Alan Kilborn Apr 6, 2025, 1:04 PM Apr 6, 2025, 1:04 PM

                      @Robert-Or-Janet-Diebel

                      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.

                      P R 2 Replies Last reply Apr 6, 2025, 2:51 PM Reply Quote 1
                      • P
                        PeterJones @Alan Kilborn
                        last edited by Apr 6, 2025, 2:51 PM

                        @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.

                        R 2 Replies Last reply Apr 6, 2025, 5:34 PM Reply Quote 2
                        • R
                          Robert Or Janet Diebel @PeterJones
                          last edited by Apr 6, 2025, 5:34 PM

                          @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.

                          1 Reply Last reply Reply Quote 0
                          • R
                            Robert Or Janet Diebel @PeterJones
                            last edited by Apr 6, 2025, 7:06 PM

                            @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
                            
                            
                            1 Reply Last reply Reply Quote 0
                            • R
                              Robert Or Janet Diebel @Alan Kilborn
                              last edited by Apr 6, 2025, 7:08 PM

                              @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
                              
                              
                              P 1 Reply Last reply Apr 6, 2025, 7:34 PM Reply Quote 0
                              • R
                                Robert Or Janet Diebel @PeterJones
                                last edited by Apr 6, 2025, 7:16 PM

                                @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.

                                1 Reply Last reply Reply Quote 0
                                • P
                                  PeterJones @Robert Or Janet Diebel
                                  last edited by PeterJones Apr 6, 2025, 7:36 PM Apr 6, 2025, 7:34 PM

                                  @Robert-Or-Janet-Diebel ,

                                  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 of C:\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.

                                  R 1 Reply Last reply Apr 6, 2025, 9:41 PM Reply Quote 1
                                  • R
                                    Robert Or Janet Diebel @PeterJones
                                    last edited by Apr 6, 2025, 9:41 PM

                                    @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.

                                    A P 2 Replies Last reply Apr 6, 2025, 10:01 PM Reply Quote 0
                                    • A
                                      Alan Kilborn @Robert Or Janet Diebel
                                      last edited by Apr 6, 2025, 10:01 PM

                                      @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.

                                      1 Reply Last reply Reply Quote 1
                                      • P
                                        PeterJones @Robert Or Janet Diebel
                                        last edited by Apr 6, 2025, 10:09 PM

                                        @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.

                                        R 2 Replies Last reply Apr 7, 2025, 1:10 AM Reply Quote 1
                                        • R
                                          Robert Or Janet Diebel @PeterJones
                                          last edited by Apr 7, 2025, 1:10 AM

                                          @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.

                                          1 Reply Last reply Reply Quote 0
                                          26 out of 51
                                          • First post
                                            26/51
                                            Last post
                                          The Community of users of the Notepad++ text editor.
                                          Powered by NodeBB | Contributors