Community
    • Login

    Launching tail-f from the command line.

    Scheduled Pinned Locked Moved General Discussion
    14 Posts 3 Posters 2.6k 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.
    • EkopalypseE
      Ekopalypse
      last edited by Ekopalypse

      No, the possible commandline parameters do not include it.
      One could, depending on how complicated stuff goes, use one of the scripting plugins like PythonScript(PS) or NppExec to try to solve it.
      For example, PS has notepad.getCommandLine method if you would
      start npp with something like notepad++.exe -multiInst -? you can
      check for the question mark and call notepad.runMenuCommand('View', 'Monitoring (tail -f)') if needed.

      Alan KilbornA 1 Reply Last reply Reply Quote 3
      • Alan KilbornA
        Alan Kilborn @Ekopalypse
        last edited by

        To use a scripting plugin like Pythonscript like @Ekopalypse suggests, you’d have to put the code to do this in its “startup” script.

        I suppose you’d also have to have some mechanism to tell it which file you wanted to put in “tail” mode, as the typical remembered session contains more than one file, and you probably wouldn’t want to put ALL files in “tail” mode.

        EkopalypseE 1 Reply Last reply Reply Quote 1
        • EkopalypseE
          Ekopalypse @Alan Kilborn
          last edited by

          put the code to do this in its “startup” script.

          preferable a “user” startup.py and in addition one needs to
          change the PS configuration from LAZY to ATSTARTUP.

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

            Probably @Ekopalypse will come up with a nice, short, fully working example for the OP. :-)

            1 Reply Last reply Reply Quote 1
            • EkopalypseE
              Ekopalypse
              last edited by

              If OP wants to go that way - maybe. ;-D

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

                @Ekopalypse

                It would serve as a good example of “adding a custom command line parameter to Notepad++” for future readers as well, who might have different need than “tail”.

                EkopalypseE 1 Reply Last reply Reply Quote 0
                • EkopalypseE
                  Ekopalypse @Alan Kilborn
                  last edited by

                  @Alan-Kilborn

                  the issue is, that you cannot set a custom parameter but the question mark seems to work.
                  But I haven’t really checked the commandline code to see if there is
                  a possible workaround.

                  Alan KilbornA 1 Reply Last reply Reply Quote 1
                  • Alan KilbornA
                    Alan Kilborn @Ekopalypse
                    last edited by

                    @Ekopalypse

                    you cannot set a custom parameter but the question mark seems to work.

                    Ah.

                    Presuming it worked more fully, more questions arise:

                    • I have a Explorer right-click “edit with N++” thing that I often use to pull into an existing N++ instance already running. If one queried the command line after that, would they see the original command line, or the one from the right-click?

                    • Does a multiple instance invoked from the first instance impact?

                    EkopalypseE 1 Reply Last reply Reply Quote 0
                    • EkopalypseE
                      Ekopalypse @Alan Kilborn
                      last edited by Ekopalypse

                      @Alan-Kilborn

                      you query the current instance, so you should always get the
                      commandline parameters associated whit this instance,
                      regardless if multiInst is used or not.

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

                        @Ekopalypse

                        But I mean, to follow the OP’s example, maybe I have N++ running then I next want to run tail on a file, so I use Explorer with my special “tail with Notepad++” rightclick. I guess there would be no good way to do the trapping with P.S., even if Notepad++ interface to get the command line was better than it is.

                        EkopalypseE 1 Reply Last reply Reply Quote 2
                        • EkopalypseE
                          Ekopalypse @Alan Kilborn
                          last edited by

                          @Alan-Kilborn

                          maybe I’m, again, not seeing the wood because of the trees.
                          Let me try to explain what I understand so far.

                          There is an running (or not as it doesn’t matter from my understanding) npp instance.
                          Now you click on the explorer context menu “open with npp in tail mode”.
                          This shortcut must be configured, of course, with something like npp -multiInst -?
                          If that new instance starts up it will execute startup.py
                          And here we would check against the -? flag and act accordingly.

                          Is that what you are talking about or do I have a plank at my head?

                          1 Reply Last reply Reply Quote 0
                          • EkopalypseE
                            Ekopalypse
                            last edited by Ekopalypse

                            I was wrong, there is a way to provide user parameters.

                            By this we could start npp with something like notepad++.exe -multiInst -nosession -z -tailmode

                            and would be able to get it up and running

                            46f2ec37-183d-4597-9787-66e2fe10c988-image.png

                            1 Reply Last reply Reply Quote 1
                            • EkopalypseE
                              Ekopalypse
                              last edited by Ekopalypse

                              This PS, saved as startup.py (user NOT machine and PS configuration changed from LAZY to ATSTARTUP) should do the trick

                              e6fb0b18-db39-4bab-a14c-ebdea5b99411-image.png

                              from Npp import notepad, MENUCOMMAND
                              if '-tailmode' in notepad.getCommandLine():
                                  notepad.menuCommand(MENUCOMMAND.VIEW_MONITORING)
                              

                              and npp like this notepad++.exe -multiInst -nosession "FULL_PATH_OF_THE_FILE" -z -tailmode

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