The script was very simple to use, just put the script in the Calibre folder, and then drag and drop the file you want to convert on the script.
Today a reader asked for 2 new features:
- being able to convert multiple files at once
- don't overwrite the epub file that may already exist
Click here to Download the new version of the script.
You need to place this script in the same folder where you have the Calibre executable.
Then you can drag and drop the file you want to convert on the script:
After the conversion, you'll find the new converted EPUB file in the same folder as the original file.
Check the original article for more information about this script, and how to use it.
About the new features
Now, for example, you can select 10 PDF files and drop them on the script, and they'll get converted to EPUB (and Author and Title will be set, check the original article for more information)
If the epub file already exist, now the script will add current date/time to the filename.
Example: you try to convert a file named "Asimov - Nightfall.pdf", the script try to create a file named "Asimov - Nightfall.epub", but if this file already exist the script will then create a file named "Asimov - Nightfall 01_01_2014 21.13.52,34.epub" by adding current date/time to the filename.
This updated script, in theory, can convert up to 400 files at once.
The real limitation came from Windows max command line length, that is limited to 8191characters.
So, in real life, you probably won't be able to drag and drop 400 files on the script, because their full pathname will be longer than 8191 characters.
By "Full pathname" i mean the full path + filename of the files, so a full pathname of a file my look something like "E:\eBook\asimov books\series\Asimov - Empire 1.pdf" whick is long 52 chars.
So if you have files like that, you can convert a maximum of about 8192 / 52 = 157 files at once.
Depending on you filename and folder structure your mileage may vary.
Inside the script...
Here is a color-coded version of the EPUB conversion script, the same script you can download here.
(color coded version of the script created by the courtesy of http://hilite.me/ using the 'native' profile, and then tweaking color by hand)
This batch file is very similar to the old one.
All the main code to do the conversion is included in a Sub function called epubConvert.
At the beginning of the file I've added about 400 lines of command like Switch / Call epubConvert %1- Switch / Call epubConvert %1 - Switch / Call epubConvert %1 - ...
By implementing these feature I even discovered a new batch command (shift) that I've never used before, it's very useful if you need to manage more than 9 command line parameters :-)