Launching tail-f from the command line.



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



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



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



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



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



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



  • @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?



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



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



  • @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?



  • 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



  • 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


Log in to reply