This page presents a newer version of the page named "Concatenate_rtf for Nisus Writer Express v. 1.1.2"; the latter is obsolete and will be replaced by this one.
Suppose that you have a bunch of rtf files created either in Nisus Writer Express v. 1.x, v. 2.0.x or in TextEdit, that you would like to concatenate (gather in a single file): for example chapters of a book that you would like to gather in a single file. The scripts contained in this package may be used in such cases.
Note that these scripts can be used ONLY for rtf files created by Nisus Writer Express v.1.x, 2.0.x or TextEdit. There are many "dialects" of rtf format, different each other. The scripts that I present here will NOT work for files created by other applications (perhaps the subsequent sub-versions of Nisus Writer Express 2.x will have the the same rtf format, but for now, I cannot be sure).
To use these scripts, gather all the files to be concatenated in a folder, rename each files "01xxx.rtf", "02xxx.rtf", etc., according to the order of their contents (files with names which don't begin with digits will be ignored).
A new rtf file, named "concat_res.rtf", containing all the text of the original files will be generated in the same folder as these files (if there is already a file of this name, the generated file will have names like "concat_res1.rtf", concat_res2.rtf", and so on).
Scripting the concatenation of rtf files is very difficult. The script that you can download here will not be able to deal correctly with the colors of text (it will take only the color table of the first file; if the subsequent files have more colors, they will be ignored). On the other hand, making a coherent stylesheet from different stylesheets is very difficult (stylesheets are supported only in Nisus Writer Express 2.0.x; TextEdit and Nisus Writer Express 1.x have not stylesheet): the present script will not take account of the values (attributes) of stylesheet of subsequent files -- it will take account only of the names of different styles (so, if there are styles of same names with different values, the latter will be ignored). In a similar way, if there are "next style" and "style based on" attributes which refer to styles that did not appear before, they will be ignored.
This package contains seven items in two folders:
- the folder "concat_rtf_files_for_v1":
This folder contains scripts which will work for TextEdit and Nisus Writer Express v. 1.x.
- concatenate_rtf_for_v1.pl
This is the "core" script which gathers rtf files and generates the result file.
You will have to put this Perl script in /Users/[your_account]/bin/ folder.
if this folder doesn't exist, just create one yourself.- concatenate_rtf_files_for_v1.app
This script is an AppleScript droplet used as an interface for the Perl script.
Put this droplet anywhere you want, preferably on the Desktop;
drag and drop a folder containing rtf files that you want to concatenate, or the files themselves -- these files must be those which have been created by Nisus Writer Express v. 1.x or TextEdit; their names must begin with digits, like "01xxx.rtf", "02xxx.rtf", and so on.- concatenate_rtf_for_v1.scpt
This is an AppleScript script to be used as a Nisus Writer Express macro. You will put it in the folder /Users/[your_account]/Library/Application Support/Nisus Writer/Macros/. Note that this macro will work only for Nisus Writer Express v. 1.x.
When you choose this menu-item in Nisus Writer's Macro menu, a folder selecting dialog will ask you to select a folder containing rtf files to be concatenated; another dialog will ask you to choose either "All the files with digits" or "Specify files": "All the files with digits" means all the files in the selected folder of which names begin with digits, like "01xxx.rtf", "02xxx.rtf", etc; if you press the button "Specify files", another dialog will prompt you to "Enter digits of first and last files: <01-10>, etc." If you specify files with this dialog, even if the selected folder contains other files with digits (e.g. "11xxx.rtf", "12xxx.rtf", etc.), they will be ignored.- the folder "concat_rtf_files_for_v2"::
- concatenate_rtf_for_v2.pl
This is the "core" script which gathers rtf files and generates the result file.
You will have to put this Perl script in /Users/[your_account]/bin/ folder.
if this folder doesn't exist, just create one yourself.- concatenate_rtf_files_for_v2.app
This script is an AppleScript droplet used as an interface for the Perl script.
Put this droplet anywhere you want, preferably on the Desktop;
drag and drop a folder containing rtf files that you want to concatenate, or the files themselves -- these files must be those which have been created by Nisus Writer Express v. 1.x; their names must begin with digits, like "01xxx.rtf", "02xxx.rtf", and so on.- concatenate_rtf_for_v2.scpt
This is an AppleScript script to be used as a Nisus Writer Express macro. You will put it in the folder /Users/[your_account]/Library/Application Support/Nisus Writer/Macros/. Note that this macro will work only for Nisus Writer Express v. 2.0.x.
When you choose this menu-item in Nisus Writer's Macro menu, a folder selecting dialog will ask you to select a folder containing rtf files to be concatenated; another dialog will ask you to choose either "All the files with digits" or "Specify files": "All the files with digits" means all the files in the selected folder of which names begin with digits, like "01xxx.rtf", "02xxx.rtf", etc; if you press the button "Specify files", another dialog will prompt you to "Enter digits of first and last files: <01-10>, etc." If you specify files with this dialog, even if the selected folder contains other files with digits (e.g. "11xxx.rtf", "12xxx.rtf", etc.), they will be ignored.
- ReadMe.rtf this file.
These scripts have been tested only on very simple and short files. I am not sure if they will work for longer and/or more complicated files. Please use them with caution!!! -- Please use copied files, not the original files, to test them. And if you have trouble or problems, please let me know (n-iyanag@ppp.bekkoame.ne.jp).
I hope you will find these scripts interesting or useful!
Have fun!
04-10-17
Download
Download the package from here (55K to download).
Go to Nisus Macros and Nisus/Frontier combo page
Go to NI Home Page
Mail to Nobumi Iyanaga
This page was last built with Frontier on a Macintosh on Sun, Oct 17, 2004 at 10:10:52 AM. Thanks for checking it out! Nobumi Iyanaga