Now that there is no longer an ANSI version of NP++ is there any way to get the .LOG function when editing in a text file?
The easiest way I can think of is contacting the author of the log mlugin and massage that person into releasing an unicode build….
I did think about doing that but since the existing ANSI version hadn't been touched since 2008 I doubted that Nicholas Heckman would be keen on producing an essentially new version for the new UNICODE-only release of NP++.
Disappointing. I started using NP++ as a replacement for Notepad, in part, because the .LOG function worked so nicely with my existing files. I suppose I will now have to start looking at alternatives to NP++. I expect this is the wrong place to ask if anyone has any suggestions for something as good as Notepad++ but with a .LOG option.
To simply add the date at the end of the file, if the file begins with ".LOG", it can easily be added to my ModelineParser plugin. You need to have PythonScript plugin, download ModelineParser https://sourceforge.net/projects/npppythonplugsq/files/Modeline%20Parser/, and install it. To detect .LOG and insert the date, simply add the following script:
from Npp import *
ModelineParser_dll.modeline_add_preparse(lambda settings, name, path, text:
text.startswith('.LOG') and (
or editor.addText(datetime.datetime.now().strftime('%Y-%m-%d %H:%M'))
You will probably have to change the date format to match what you like; see http://docs.python.org/library/datetime.html#strftime-and-strptime-behavior.
That looks good. I'll install the latest UNICODE version of NP++ (obviously I only have ANSI version installed) and give it a try.
I've now installed Notepad++ 6.2 unicode, Python Script 0.9.2.0 which included Python 2.7.1, and ModelineParser_0.2.
Python Script starts OK, the Python Script console will display if I select it, ATSTARTUP is selected. Modeline Parser shows on the Plugins menu. The ModelineLog.py script is in the "Notepad++\plugins\PythonScript\lib" folder.
Everything looks fine except that when I open a txt file that starts with .LOG nothing happens.
What have I missed?
To automatically load the plugin on Notepad++ startup, you need to add the following lines to the startup.py script (in Notepad++\plugins\PythonScript\scripts):
Is it working?
That was it. I hadn't added the ModelineLog entry. Done it now and it works perfectly.