Reason
A large number of sci-fi novels were written from VeryCD one day, but they were in Txt format. In order to be able to enjoy it on the IPad, we had to convert it into PDF. I wrote a VBScript because I didn't have any tools.
The script should have the following capabilities:
1. Convert the document into PDF format;
2. Support single document and batch conversion;
3. Right-click menu is supported;
4. Supports the code format;
5. configurable;
Here, Word is used to help implement the conversion function, and Word also supports setting the format, so that you can support code keyword coloring according to the configuration.
A little salt.
The script is divided into several modules:
1. Constant definition;
2. Global variable definition;
3. Auxiliary Function: Hash;
4. Auxiliary Function: path;
5. Auxiliary Functions: Reading configuration files;
6. Registry;
7. document formatting;
8. Main function;
Basic Principles:
1. register the script to the right-click menu;
2. Determine the behavior based on the running parameters: Registration, conversion of a single file, and conversion of directory files;
3. Use Word to save the document as PDF for conversion;
4. Set the font of the Word document to color the keywords;