Page 1 of 1
Script Request - Text Merging Tool.
Posted: 22 Oct 2010 21:21
by SkyFrontier
I need a tool to scan current folder after .txt (but this can be user-defined, being able to read text-based files), read (readfile) one after the other and
observing a given sort order they are displayed in list (sorted by name, date, etc...), build a single file with all contents merged, separating each entry using something like
Code: Select all
Entry 1
<crlf>
================================
<crlf>
Entry 2
<crlf>
================================
<crlf>
...
It's important for this to be able to read/write preserving unicode.
Thanks!
Re: Script Request - Text Merging Tool.
Posted: 22 Oct 2010 21:41
by SkyFrontier
...can this tool be able to search and replace text strings, preferably as a second optional stage and if defined by user, do that on the writefrile stage at the merging time?
Re: Script Request - Text Merging Tool.
Posted: 03 Nov 2010 23:24
by SkyFrontier
Couldn't provide the
SkyFrontier wrote:...can this tool be able to search and replace text strings, preferably as a second optional stage and if defined by user, do that on the writefrile stage at the merging time?
thing.
...but this one merges text-based files in
sequential order both for reading and writing (results are unpredictable if a non-text based file is listed among text-based files. ToDo/workaround: add filter to list? This may affect the overall performance of the script rendering it useless... perhaps).
Resulting file will be an unicode one.
Trash:
zzzSEPARATOR.txt at the end of the list, presumably to make easier to locate where is the last entry at the target
_MergedText.txt.
This is an
address bar-only code - don't forget to press ESC at the end of the list, when operation is finished!
Code: Select all
::writeFile("zzzSEPARATOR.txt", "====End=of=File===SEPARATOR====End=of=File===", o); $a = readfile(<curitem>); copytext $a; writeFile("_MergedText.txt", "<crlf><crlf>$a<crlf><crlf>==================", a, tu); focus; sendkeys'{down}'; focus a; sendkeys"{enter}";