• Login
Community
  • Login

Find, Replace, and Count

Scheduled Pinned Locked Moved General Discussion
26 Posts 3 Posters 1.5k 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.
  • J
    Javier Rivas @Ekopalypse
    last edited by Jan 15, 2021, 10:05 PM

    @Ekopalypse I read over it, but I am a bit confused on how to set this up. What goes where, saved in what, I did install Pythons Script Plugin and the Python.exe

    1 Reply Last reply Reply Quote 0
    • E
      Ekopalypse @Javier Rivas
      last edited by Jan 15, 2021, 10:07 PM

      You only need python script plugin, it contains the python library.

      Create a new script by using plugin->pythonscript->new script
      give it a meaningful name and save it.
      Put the following content into it.

      from Npp import editor
      
      add_this = 1000000 - 60
      
      def add_60(m):
          global add_this
          add_this += 60
          return add_this
      
      editor.replace('FZ', add_60)
      

      Save it. Done.
      Execute it via plugin->pythonscript->scripts->NAME_YOU_CHOSE

      J 1 Reply Last reply Jan 15, 2021, 11:07 PM Reply Quote 3
      • E
        Ekopalypse
        last edited by Ekopalypse Jan 15, 2021, 10:09 PM Jan 15, 2021, 10:08 PM

        If you need it more often you can assign a keyboard shortcut
        or create a toolbar icon by using the configuration menu from pythonscript plugin menu and shortcut mapper.

        J 1 Reply Last reply Jan 15, 2021, 11:03 PM Reply Quote 1
        • J
          Javier Rivas @Ekopalypse
          last edited by Jan 15, 2021, 11:03 PM

          @Ekopalypse Yes, I would be using a lot, and I follow the steps and I don’t see how to choose the name I saved it as

          OK, I found how to add short cuts, but can’t find my saved name under your steps

          1 Reply Last reply Reply Quote 0
          • J
            Javier Rivas @Ekopalypse
            last edited by Jan 15, 2021, 11:07 PM

            @Ekopalypse all I see is Sample and Startup

            1 Reply Last reply Reply Quote 0
            • E
              Ekopalypse
              last edited by Ekopalypse Jan 15, 2021, 11:13 PM Jan 15, 2021, 11:11 PM

              did you click on User Scripts?

              1a6e1eb9-e6de-4960-9e2d-f495452be7ac-image.png

              and before you can assign a shortcut or see the icon in the toolbar, you have to restart npp, because npp reads/retrieves this information only at startup.

              J 1 Reply Last reply Jan 15, 2021, 11:17 PM Reply Quote 0
              • J
                Javier Rivas @Ekopalypse
                last edited by Jan 15, 2021, 11:17 PM

                @Ekopalypse Yes

                E 1 Reply Last reply Jan 15, 2021, 11:18 PM Reply Quote 0
                • E
                  Ekopalypse @Javier Rivas
                  last edited by Jan 15, 2021, 11:18 PM

                  @Javier-Rivas

                  Yes? It works now or still not seeing it?

                  J 1 Reply Last reply Jan 15, 2021, 11:19 PM Reply Quote 0
                  • J
                    Javier Rivas @Ekopalypse
                    last edited by Jan 15, 2021, 11:19 PM

                    @Ekopalypse sorry, don’t see it, and yes I click on user

                    E 1 Reply Last reply Jan 15, 2021, 11:19 PM Reply Quote 0
                    • E
                      Ekopalypse @Javier Rivas
                      last edited by Jan 15, 2021, 11:19 PM

                      @Javier-Rivas

                      Can you post your debug info which is available from the ? menu?

                      J 1 Reply Last reply Jan 15, 2021, 11:24 PM Reply Quote 0
                      • J
                        Javier Rivas @Ekopalypse
                        last edited by Jan 15, 2021, 11:24 PM

                        @Ekopalypse Notepad++ v7.9.1 (64-bit)
                        Build time : Nov 2 2020 - 01:07:46
                        Path : C:\Program Files\Notepad++\notepad++.exe
                        Admin mode : OFF
                        Local Conf mode : OFF
                        OS Name : Windows 10 Pro (64-bit)
                        OS Version : 2004
                        OS Build : 19041.746
                        Current ANSI codepage : 1252
                        Plugins : ComparePlugin.dll MarkdownViewerPlusPlus.dll mimeTools.dll NppConverter.dll NppExport.dll NppMarkdownPanel.dll NppToolBucket.dll PythonScript.dll _CustomizeToolbar.dll

                        E 1 Reply Last reply Jan 15, 2021, 11:27 PM Reply Quote 0
                        • E
                          Ekopalypse @Javier Rivas
                          last edited by Ekopalypse Jan 15, 2021, 11:28 PM Jan 15, 2021, 11:27 PM

                          @Javier-Rivas said in Find, Replace, and Count:

                          Local Conf mode : OFF

                          means that the scripts will be saved in
                          %APPDATA%\notepad++\plugins\config\pythonscript\scripts

                          You can copy and past this into an explorer and it should get you there. Do you see your script there?

                          1 Reply Last reply Reply Quote 0
                          • E
                            Ekopalypse
                            last edited by Jan 15, 2021, 11:29 PM

                            Could it be that you named your script without the .py extension?

                            J A 2 Replies Last reply Jan 15, 2021, 11:33 PM Reply Quote 0
                            • J
                              Javier Rivas @Ekopalypse
                              last edited by Javier Rivas Jan 15, 2021, 11:34 PM Jan 15, 2021, 11:33 PM

                              @Ekopalypse Yes, I got it now, I have to add the .py to it did not know that
                              Thank you very much I have my shortcut and it worked perfectly

                              I thought just name it and save

                              E 1 Reply Last reply Jan 15, 2021, 11:34 PM Reply Quote 1
                              • E
                                Ekopalypse @Javier Rivas
                                last edited by Jan 15, 2021, 11:34 PM

                                @Javier-Rivas said in Find, Replace, and Count:

                                I thought just name it and save

                                I was sloppy there, sorry.

                                J 1 Reply Last reply Jan 15, 2021, 11:38 PM Reply Quote 0
                                • J
                                  Javier Rivas @Ekopalypse
                                  last edited by Jan 15, 2021, 11:38 PM

                                  @Ekopalypse Hey so is there a way to edit what was saved in notepad++, because as weeks go by I would have to edit the script and add a new timestamp to it, the 100000 represents a timestamp so it was just an example, everything else works great

                                  E 1 Reply Last reply Jan 15, 2021, 11:39 PM Reply Quote 0
                                  • E
                                    Ekopalypse @Javier Rivas
                                    last edited by Jan 15, 2021, 11:39 PM

                                    @Javier-Rivas

                                    Yes of course, press CTRL and click the script.
                                    Works as long as you do NOT assign a CTRL+KEY shortcut.

                                    E 1 Reply Last reply Jan 15, 2021, 11:41 PM Reply Quote 1
                                    • E
                                      Ekopalypse @Ekopalypse
                                      last edited by Jan 15, 2021, 11:41 PM

                                      @Ekopalypse

                                      By the way, is the timestamp calculable?

                                      J 1 Reply Last reply Jan 16, 2021, 12:11 AM Reply Quote 0
                                      • J
                                        Javier Rivas @Ekopalypse
                                        last edited by Jan 16, 2021, 12:11 AM

                                        @Ekopalypse Yes, it is calculable, what I do is I go to the website and get a timestamp and I add 60 sec to each stamp, I have 10 timestamps all 1 minute apart

                                        E 1 Reply Last reply Jan 16, 2021, 12:15 AM Reply Quote 0
                                        • E
                                          Ekopalypse @Javier Rivas
                                          last edited by Jan 16, 2021, 12:15 AM

                                          @Javier-Rivas

                                          I ASSUME that this can also be automated.
                                          If you are interested and the site is public, we can try it.
                                          But, sorry, no more today - it’s already 01:00 AM here.
                                          Good night everyone.

                                          J 1 Reply Last reply Jan 16, 2021, 12:40 AM Reply Quote 0
                                          13 out of 26
                                          • First post
                                            13/26
                                            Last post
                                          The Community of users of the Notepad++ text editor.
                                          Powered by NodeBB | Contributors