Community
    • Login

    Running a macro on all the open docs ?.

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    51 Posts 4 Posters 1.1k 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.
    • PeterJonesP
      PeterJones @Robert Or Janet Diebel
      last edited by

      @Robert-Or-Janet-Diebel said in Running a macro on all the open docs ?.:

      Could you give me a procedure for running files with PythonScript please?

      FAQ

      1 Reply Last reply Reply Quote 2
      • PeterJonesP
        PeterJones @Robert Or Janet Diebel
        last edited by

        I will try to get this working, but I am not too familiar with Python.

        You don’t need to. Literally all you have to do to edit the script is to change the text DoNothing to be the exact name of your Macro.

        Robert Or Janet DiebelR 2 Replies Last reply Reply Quote 2
        • Robert Or Janet DiebelR
          Robert Or Janet Diebel @PeterJones
          last edited by

          @PeterJones When I run it a very quick window flashes up with no time to see any output, or errors.
          When I open The console I try to paste the program, that does not work.

          PeterJonesP 2 Replies Last reply Reply Quote 0
          • PeterJonesP
            PeterJones @Robert Or Janet Diebel
            last edited by PeterJones

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

            Robert Or Janet DiebelR 1 Reply Last reply Reply Quote 1
            • PeterJonesP
              PeterJones @Robert Or Janet Diebel
              last edited by

              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.

              Robert Or Janet DiebelR 1 Reply Last reply Reply Quote 1
              • Robert Or Janet DiebelR
                Robert Or Janet Diebel @PeterJones
                last edited by

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

                PeterJonesP 1 Reply Last reply Reply Quote 0
                • Robert Or Janet DiebelR
                  Robert Or Janet Diebel @PeterJones
                  last edited by

                  @PeterJones OK, Thanx

                  1 Reply Last reply Reply Quote 0
                  • PeterJonesP
                    PeterJones @Robert Or Janet Diebel
                    last edited by

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

                    Robert Or Janet DiebelR 4 Replies Last reply Reply Quote 1
                    • Robert Or Janet DiebelR
                      Robert Or Janet Diebel @PeterJones
                      last edited by

                      @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
                      • Robert Or Janet DiebelR
                        Robert Or Janet Diebel @PeterJones
                        last edited by

                        @PeterJones I have read the FAQ

                        PeterJonesP 1 Reply Last reply Reply Quote 0
                        • Robert Or Janet DiebelR
                          Robert Or Janet Diebel @PeterJones
                          last edited by

                          @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
                          • Robert Or Janet DiebelR
                            Robert Or Janet Diebel @PeterJones
                            last edited by

                            @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
                            • PeterJonesP
                              PeterJones @Robert Or Janet Diebel
                              last edited by PeterJones

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

                              Robert Or Janet DiebelR 1 Reply Last reply Reply Quote 1
                              • Robert Or Janet DiebelR
                                Robert Or Janet Diebel @PeterJones
                                last edited by

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

                                PeterJonesP 1 Reply Last reply Reply Quote 0
                                • PeterJonesP
                                  PeterJones @Robert Or Janet Diebel
                                  last edited by

                                  @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
                                  • Alan KilbornA
                                    Alan Kilborn @Alan Kilborn
                                    last edited by

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

                                    Robert Or Janet DiebelR Alan KilbornA 2 Replies Last reply Reply Quote 0
                                    • Robert Or Janet DiebelR
                                      Robert Or Janet Diebel @Alan Kilborn
                                      last edited by

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

                                      Alan KilbornA 1 Reply Last reply Reply Quote 0
                                      • Alan KilbornA
                                        Alan Kilborn @Robert Or Janet Diebel
                                        last edited by Alan Kilborn

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

                                        PeterJonesP Robert Or Janet DiebelR 2 Replies Last reply Reply Quote 1
                                        • PeterJonesP
                                          PeterJones @Alan Kilborn
                                          last edited by

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

                                          Robert Or Janet DiebelR 2 Replies Last reply Reply Quote 2
                                          • Robert Or Janet DiebelR
                                            Robert Or Janet Diebel @PeterJones
                                            last edited by

                                            @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
                                            • First post
                                              Last post
                                            The Community of users of the Notepad++ text editor.
                                            Powered by NodeBB | Contributors