Execute a menu command on startup?

2012-02-20
2012-11-13
  • Brian Benson

    Brian Benson - 2012-02-20

    I'd like to be able to open two files and compare them automatically.  I can open two files using the VB SHELL command, but I'd like to be able to execute the "Plugins>Compare>Compare" (Alt + D) menu selection automatically as soon as the files are opened.

    Is there a way to do this?

     
  • cchris

    cchris - 2012-02-21

    Using Python Script, you can write a script that loads both files and invokes Compare, and mark he script as being run at startup.

    CChris

     
  • Brian Benson

    Brian Benson - 2012-02-21

    Thanks CChris.  I am aware of Python Script, but was hoping that was an easier way to do what I was trying to do.

    I read the quite a bit of the Python Script documentation, but was a little unclear on how the start up script was specified.  In other words if the start up script could be a parameter that could be passed to npp when it was launched or if it was always the same script (i.e. startup.py or something like that).

    Since I want to launch npp programmatically and pass in the paths of the two files to compare, it would be nice if I could pass in the path to the python script to use as well, but I don't think that can be done.

    It looks like I've got some experimenting to do to figure out how Python Script works.

    Thank you for your reply.

     
  • François-R Boyer

    Without having to pass things as parameters, you can still use Python Script to open the files and compare them on startup. This can be done by adding an "import todoOnStartup" in the "startup.py", and generating the "todoOnStartup.py" script just before starting Notepad++. The script could erase itself so that it would not execute the same comparison on next startup of Notepad++.

     
  • Brian Benson

    Brian Benson - 2012-02-21

    Thank you frboyer.  That sounds like it would work.