Script Request - Text Merging Tool.

Discuss and share scripts and script files...
Post Reply
SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Script Request - Text Merging Tool.

Post 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!
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: Script Request - Text Merging Tool.

Post 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?
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: Script Request - Text Merging Tool.

Post 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}";
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

Post Reply