Thread: doc to epub
View Single Post
Old 03-09-2010, 07:35 PM   #56
frabjous
Wizard
frabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameter
 
frabjous's Avatar
 
Posts: 1,213
Karma: 12890
Join Date: Feb 2009
Location: Amherst, Massachusetts, USA
Device: Sony PRS-505
My knowledge of Windows batch files is very limited -- hopefully adikira will chime in, but I *think* something along these lines should work to parse Author-File.doc to the metadata:

(For 64 bit Windows, just converting .doc to .epub)

Code:
for %%I in (*.doc) do (
for /f "tokens=1,2 delims=-" %%a in ("%%~nI") do (
   "C:\Program Files (x86)\AbiWord\bin\AbiWord.exe" --to=html "%%I"
   "C:\Program Files (x86)\Calibre2\ebook-convert.exe" "%%~nI.html" "%%~nI.epub" --authors="%%a" --title="%%b"
)
)
For 32 bit Windows you can use Adikira's trick of %PROGRAMFILES%:

Code:
for %%I in (*.doc) do (
for /f "tokens=1,2 delims=-" %%a in ("%%~nI") do (
   "%PROGRAMFILES%\AbiWord\bin\AbiWord.exe" --to=html "%%I"
   "%PROGRAMFILES%\Program Files (x86)\Calibre2\ebook-convert.exe" "%%~nI.html" "%%~nI.epub" --authors="%%a" --title="%%b"
)
)
This did not bypass the need for a different file for 32 bit and 64 bit, since I found that %PROGRAMFILES% expands to "C:\Program Files\" even on 64 bit systems, and hence, this wouldn't work if your executables are under "C:\Program Files (x86)\".

No clue what that will do with files that don't have dashes in them. Too lazy to check.

This would be very easy on linux.
frabjous is offline   Reply With Quote