Need help: Comment with timestamp?

Stefan M.
2014-02-21
2014-02-21
  • Stefan M.

    Stefan M. - 2014-02-21

    Is it possible to insert a comment (e.g. beginning with "//") with Name + Timestamp with one keypress in Notepad++ ? I did not find a possibility to insert both at the same time.

     
  • dail8859

    dail8859 - 2014-02-21

    It doesn't have this ability built in but a there are a few plugins you can look into.

    The Python Script plugin allows you to extend N++ by writing in Python. What you want should be possible in just a few lines of code, and you can attach a shortcut to the script.

    NppExec also allows you to write scripts (in its own language). I don't think it can natively get a timestamp but iirc it can call external commands or batch files. You would need to check into this more.

    Also the TextFx plugin has a shortcut to insert the date/time but for some reason it doesn't seem to play nice when trying to record a macro which calls one of its commands.

    Hopefully this will at least get you pointed in the right direction. Also, these plugins are all available through the Plugin Manager.

     
  • Stefan M.

    Stefan M. - 2014-02-21

    OK, thanks a lot!
    I used Python-Script and the following lines:


    import time
    editor.addText("// MyTestComment, " + time.strftime('%d.%m.%Y (%H:%M)') )


     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks