Community
    • Login

    Automate blank space on or carriage return

    Scheduled Pinned Locked Moved General Discussion
    14 Posts 4 Posters 423 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 @Carlton Patterson
      last edited by

      @Carlton-Patterson ,

      Macros are simple keystroke/menu replicators; they have no concept of time.

      You can see our FAQ on automating Notepad++ to find out more about what macros can and cannot do, and what options there are for you when macros are not sufficient for your task.

      Carlton PattersonC 1 Reply Last reply Reply Quote 0
      • Carlton PattersonC
        Carlton Patterson @PeterJones
        last edited by

        @PeterJones thanks for getting in touch. I appreciate macros have no concept of time. Is it there possible to write a macro or automate the moving of the cursor in Notepad ++

        PeterJonesP 1 Reply Last reply Reply Quote 0
        • PeterJonesP
          PeterJones @Carlton Patterson
          last edited by PeterJones

          @Carlton-Patterson ,

          “cursor” can have two meanings – the typing cursor (known as the “caret” in Notepad++ and other text editing environments) and the mouse cursor (the “pointer”).

          You cannot use a macro to move the pointer. You can easily use a macro to move the caret.

          If you use the arrow keys to move the caret while recording the macro, it will record those caret movements, because it’s recording those arrow-key keystrokes (or, technically, the command that is issued when you hit those keys). And you can also record the typing of a character (like the newline sequence when you hit ENTER) because that’s a keystroke.

          Macros record keystrokes (like typing or arrowing) and menu commands. I guess I need to clarify that in the FAQ slightly. update: I have clarified the FAQ to explain in more detail what “Notepad++ actions” mean, because the old parenthetical definition was too ambiguous

          Carlton PattersonC 1 Reply Last reply Reply Quote 1
          • Carlton PattersonC
            Carlton Patterson @PeterJones
            last edited by

            @PeterJones , so the question then becomes, is it possible to the keystroke to run continuously?

            PeterJonesP 1 Reply Last reply Reply Quote 0
            • PeterJonesP
              PeterJones @Carlton Patterson
              last edited by

              @Carlton-Patterson said in Automate blank space on or carriage return:

              possible to the keystroke to run continuously

              You cannot make a macro truly loop forever. There would be no useful macro function that would do such a thing – macros make immediate changes, and so a macro that ran continuously would make continuous changes, which is nonsensical. If you want to trigger some event when specific text is entered, you would need one of the scripting plugins, not the macro feature.

              As the FAQ said (I am still not convinced you’ve read the FAQ), Macros don’t have an internal looping construct. You can use the Macro > Run a Macro Multiple Times to run it a specific number of times, but that’s not the same thing as “continuously”.

              You still appear to be trying to think of the macro as a true programming language: it is not! If you want your automation task to do anything more than “run this set of commands once” or “run this exact set of commands a specific number of times”, then you need to switch away from macros and move to a scripting plugin. If you want it to change behavior between each loop, macros cannot do that. If you want it to increment a counter and use that counter, macros cannot do that. If you want “if” statements or “delay” statements, macros cannot do that. I don’t see how I can say that any more clearly, whether in the FAQ or here.

              Read the FAQ.

              1 Reply Last reply Reply Quote 2
              • Alan KilbornA
                Alan Kilborn @Carlton Patterson
                last edited by

                @Carlton-Patterson said in Automate blank space on or carriage return:

                Can someone let me know if its possible to automate the creation of a blank space, say every 5mins, or a carriage return every 5 mins? If it’s not possible to automate every 5 mins, can someone let me know if its possible to automate either a blank space or carriage at all?

                Sometimes solutions can be driven by further explanations.
                What do you expect to achieve by this – i.e, what is its use?
                I can hardly see how adding a space or a line-ending every 5 minutes is useful.

                Jim DaileyJ 1 Reply Last reply Reply Quote 3
                • Jim DaileyJ
                  Jim Dailey @Alan Kilborn
                  last edited by

                  @Alan-Kilborn Perhaps to keep a screen saver from activating.

                  PeterJonesP 1 Reply Last reply Reply Quote 0
                  • PeterJonesP
                    PeterJones @Jim Dailey
                    last edited by PeterJones

                    @Jim-Dailey said in Automate blank space on or carriage return:

                    Perhaps to keep a screen saver from activating.

                    Then macro is not the right choice, scripting plugin is. (Or, better, a keepalive app, because Notepad++ is not designed to be used as something to keep screensavers from activating. I actually tried with PythonScript once, but it wasn’t as reliable as a standalone keepalive app.)

                    Alan KilbornA Carlton PattersonC 2 Replies Last reply Reply Quote 3
                    • Alan KilbornA
                      Alan Kilborn @PeterJones
                      last edited by Alan Kilborn

                      @Jim-Dailey said:

                      Perhaps to keep a screen saver from activating.

                      OK, there’s a good reason; I’d like to hear from the OP as well.


                      @PeterJones said:

                      I actually tried with PythonScript once, but it wasn’t as reliable…

                      Me, too; mine was SUCCESSFUL. :-)

                      1 Reply Last reply Reply Quote 0
                      • Carlton PattersonC
                        Carlton Patterson @PeterJones
                        last edited by

                        @PeterJones someone helped me with my original quest with the following Python code

                        from time import sleep
                        
                        for i in range(10):     # The text will be appended 10 times, put the value you need
                            sleep(5*60)         # 5 min
                            editor.appendText("\nWHATEVER YOU WANT")
                        

                        Although the code works, it doesn’t keep my screen alive. Can you think of any keep alive app as you mentioned?

                        PeterJonesP Jim DaileyJ 2 Replies Last reply Reply Quote 0
                        • PeterJonesP
                          PeterJones @Carlton Patterson
                          last edited by

                          @Carlton-Patterson said in Automate blank space on or carriage return:

                          Although the code works, it doesn’t keep my screen alive.

                          Nope, because screen savers / screen locking from the OS has to do with keyboard/mouse input, not activity inside an app.

                          Can you think of any keep alive app as you mentioned?

                          You could google “app to prevent screensaver or sleep mode” or something similar.

                          Or you could notice the script that @Alan-Kilborn already linked you to on the word SUCCESSFUL in his post – that script works in the PythonScript plugin, and worked for him to prevent the screensaver from activating. So you could use that script.

                          1 Reply Last reply Reply Quote 2
                          • Jim DaileyJ
                            Jim Dailey @Carlton Patterson
                            last edited by

                            @Carlton-Patterson I have a USB device that someone purchased for a group of us at work some years ago. It randomly fakes some sort of user input that keeps the screen saver from kicking in.

                            I don’t know if they still make them or if there are now ways to detect and ignore/disable their effect. In any case, if you want to search for one, it is a WiebeTECH “Mouse Jiggler”.

                            Alan KilbornA 1 Reply Last reply Reply Quote 0
                            • Alan KilbornA
                              Alan Kilborn @Jim Dailey
                              last edited by

                              @Jim-Dailey said:

                              I have a USB device that someone purchased…

                              We’re getting off-topic but I’ll just point out that a script costs less. :-)

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