For future reference, I’ll post the the full updated script for creating the documents and appending additional text to the top/bottom of each generated document here just in case any future people are interested.
# encoding=utf-8 """in response to https://community.notepad-plus-plus.org/topic/19738/ , the 2022-May-10 add-on set nChars to be the maximum "chunk" size, replace ENTER YOUR TEXT HERE with your own text, then run this script. """ from Npp import editor, notepad import os.path nChars = 9000 regex = r'(?s).{1,' + str(nChars) + r'}(\R|\z)' counter = 0 originalFullname = notepad.getCurrentFilename() originalPath, originalFile = os.path.split( originalFullname ) originalBase, originalExt = os.path.splitext( originalFile ) def withChunk(m): global counter counter += 1 newPath = "{}\\{}_{:03d}{}".format(originalPath, originalBase, counter, originalExt) #console.write( "{}\tlength={}".format(newPath, len(m.group(0)))+"\n") notepad.new() editor.setText(m.group(0)) editor.documentStart() editor.addText('ENTER YOUR TEXT HERE\n\n') editor.appendText('ENTER YOUR TEXT HERE') notepad.saveAs(newPath) notepad.close() notepad.activateFile(originalFullname) editor.research(regex, withChunk)-
0 Votes9 Posts2k Views
-
0 Votes4 Posts2k Views
-
0 Votes4 Posts611 Views
-
0 Votes4 Posts1k Views
-
0 Votes7 Posts1k Views
-
0 Votes4 Posts3k Views
-
0 Votes2 Posts2k Views
-
0 Votes4 Posts461 Views
-
0 Votes2 Posts508 Views
-
0 Votes2 Posts307 Views
-
0 Votes5 Posts841 Views
-
0 Votes2 Posts1k Views
-
0 Votes8 Posts2k Views
-
0 Votes3 Posts3k Views
-
0 Votes2 Posts310 Views
-
0 Votes23 Posts21k Views
-
0 Votes2 Posts290 Views
-
0 Votes6 Posts3k Views
-
0 Votes7 Posts5k Views
-
0 Votes2 Posts330 Views