Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 03-02-2010, 03:02 PM   #46
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
No problem, but if you're just converting HTML to ePub, you could run calibre and drag the file or file(s) into the calibre window, and use the rather more user-friendly conversion menus in there. Not that there's anything wrong with using my script... it's that most people prefer graphical user interfaces to command-line shell scripts.
frabjous is offline   Reply With Quote
Old 03-04-2010, 04:58 PM   #47
adikira
Member
adikira is on a distinguished road
 
Posts: 11
Karma: 66
Join Date: Mar 2010
Device: Sony Reader Daily (PRS-900)
frabjous, thanks, this is a useful method - i don't need to use sony's reader library for this anymore (I still need to check if abiword supports docx though).

by the way, the content of the doc2epub.bat file can be replaced with:

Quote:
for %%I in (*.doc) do "%PROGRAMFILES%\AbiWord\bin\AbiWord.exe" --to=html "%%I"
for %%I in (*.html) do "%PROGRAMFILES%\Calibre2\ebook-convert.exe" "%%I" "%%~nI.epub"
so that one doesn't need to worry if it's a 64 or 32 system

Last edited by adikira; 03-04-2010 at 05:31 PM.
adikira is offline   Reply With Quote
Advert
Old 03-04-2010, 06:22 PM   #48
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
That's a nice tip, thanks. I don't usually use Windows, so I was trying to figure out how to do that on the fly. (I'm used to executables being put in my "path".) Anyway, thanks.

AbiWord supports .docx -- at least any recent version does. (Of course, you'll need to change (*.doc) to (*.docx) or (*.doc *docx) in the batch file.)

If installing on Windows, be sure to do a custom install and check to install the extra import and export plugins. I think you get .docx even without installing the extras, but that way you even get relatively arcane things, like latex.
frabjous is offline   Reply With Quote
Old 03-05-2010, 11:43 AM   #49
adikira
Member
adikira is on a distinguished road
 
Posts: 11
Karma: 66
Join Date: Mar 2010
Device: Sony Reader Daily (PRS-900)
Welcome. I use a lot of Unix shell scripting at work but at home I still use Windows. When it comes to command line scripting Windows completely sucks! I may give powershell a try though.

Anyway, I updated the batch file to give more flexibility. It can take two arguments the file extension that you are converting from and the extension you are converting to (which defaults to epub if missing). If the extension you are converting from is doc or docx it first runs AbiWord to convert to html first otherwise it just uses Caliber's convertor.

It should be saved to a batch file such as "convert.bat." It's recommended that this file (convert.bat) is saved in the Windows directory so that it's in the PATH variable and can be called up from any folder. Otherwise the full path the the convert.bat needs to be specified or it needs to be in the current folder (of course).


Quote:
@ECHO OFF
if "%1"=="" GOTO USAGE
if "%1"=="doc" GOTO ABI
if "%1"=="docx" GOTO ABI
SET doAbi=no

:CALIBRE
if "%2"=="" SET ext2=epub
if "%2"!==!"" SET ext2=%2
if "%doAbi%"=="yes" SET ext1=html
if "%doAbi%"=="no" SET ext1=%1
echo Converting "%ext1%" to "%ext2%" using Calibre
for %%I in (*.%ext1%) do "%PROGRAMFILES%\Calibre2\ebook-convert.exe" "%%I" "%%~nI.%ext2%"
GOTO END

:ABI
SET doAbi=yes
echo Converting "%1" to "html" using AbiWord
for %%I in (*.%1) do "%PROGRAMFILES%\AbiWord\bin\AbiWord.exe" --to=html "%%I"
GOTO CALIBRE

:USAGE
echo "Usage %0 <first_extension> <second_extension>"
echo "Example: %0 doc epub"
echo "If <second_extension> is not specified it defaults to 'epub'"

:END

Last edited by adikira; 03-05-2010 at 11:47 AM.
adikira is offline   Reply With Quote
Old 03-05-2010, 12:26 PM   #50
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
Excellent.

I'm learning stuff about Windows batch files by looking at it. Since, like you, I normally just write Unix/linux shell scripts (e.g. bash), writing batch files for Windows usually only comes up for me when I want to help someone here and need a way to translate something I already know how to do in linux to Windows. This will be very helpful.

I guess the only downside to your method, however, is that since it needs to be passed arguments, you can't tell someone just to cut and paste into Notepad, save and double click the icon -- the people actually have to go to the command prompt and navigate to the appropriate folder. Not really a difficult concept for those of us who remember DOS, or use UNIX/linux where this is relatively commonplace, but a number of Windows users who come here looking for help are often intimidated by doing anything through a command line interface, unfortunately.

(Though I suppose you could just make two batch files, with one calling the other if need be.)

Last edited by frabjous; 03-05-2010 at 12:30 PM.
frabjous is offline   Reply With Quote
Advert
Old 03-05-2010, 06:08 PM   #51
awp
Addict
awp exercises by bench pressing the entire Harry Potter series in hardcoverawp exercises by bench pressing the entire Harry Potter series in hardcoverawp exercises by bench pressing the entire Harry Potter series in hardcoverawp exercises by bench pressing the entire Harry Potter series in hardcoverawp exercises by bench pressing the entire Harry Potter series in hardcoverawp exercises by bench pressing the entire Harry Potter series in hardcoverawp exercises by bench pressing the entire Harry Potter series in hardcoverawp exercises by bench pressing the entire Harry Potter series in hardcoverawp exercises by bench pressing the entire Harry Potter series in hardcoverawp exercises by bench pressing the entire Harry Potter series in hardcoverawp exercises by bench pressing the entire Harry Potter series in hardcover
 
awp's Avatar
 
Posts: 228
Karma: 16000
Join Date: Jun 2009
Device: Sony PRS-T1
Quote:
Originally Posted by Laura81 View Post
Atlantis doesn't do batch convert by chance does it?
The latest beta version of Atlantis Word Processor has the "batch conversion" command:

https://www.mobileread.com/forums/sho...673#post817673
awp is offline   Reply With Quote
Old 03-05-2010, 11:38 PM   #52
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 9,864
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Nexus 7
Quote:
Originally Posted by awp View Post
The latest beta version of Atlantis Word Processor has the "batch conversion" command:

https://www.mobileread.com/forums/sho...673#post817673
Thanks for letting us know. It's nice to have a company read the threads on here and adjust their product according to people's needs.
DoctorOhh is offline   Reply With Quote
Old 03-09-2010, 01:16 PM   #53
Fith
Enthusiast
Fith began at the beginning.
 
Posts: 36
Karma: 10
Join Date: Feb 2010
Device: BeBook Neo / Onyx Boox 60
Glad I found this as it's proving most useful, Thanks!

Any Idea how to get "Author - Title.doc" from the file name?
Fith is offline   Reply With Quote
Old 03-09-2010, 02:10 PM   #54
awp
Addict
awp exercises by bench pressing the entire Harry Potter series in hardcoverawp exercises by bench pressing the entire Harry Potter series in hardcoverawp exercises by bench pressing the entire Harry Potter series in hardcoverawp exercises by bench pressing the entire Harry Potter series in hardcoverawp exercises by bench pressing the entire Harry Potter series in hardcoverawp exercises by bench pressing the entire Harry Potter series in hardcoverawp exercises by bench pressing the entire Harry Potter series in hardcoverawp exercises by bench pressing the entire Harry Potter series in hardcoverawp exercises by bench pressing the entire Harry Potter series in hardcoverawp exercises by bench pressing the entire Harry Potter series in hardcoverawp exercises by bench pressing the entire Harry Potter series in hardcover
 
awp's Avatar
 
Posts: 228
Karma: 16000
Join Date: Jun 2009
Device: Sony PRS-T1
Did you mean how to get "author" and "title" from a DOC filename when using the Batch Conversion command of Atlantis Word Processor? If so, the "Batch conversion" command of the latest version of Atlantis retrieves this information from the source document in the following way.

It checks the document Properties (you can view them in Atlantis if you open a document in Atlantis, then choose the "File | Properties..." menu command of Atlantis).
If the "Title" property is not blank, Atlantis uses it as the "Title" EPUB metadata item. If the "Title" property is blank, Atlantis uses the document filename without the file path and extension.
If the "Author" property of the source document is not blank, Atlantis uses it as the "Author" EPUB metadata item. Otherwise the "User name" from the "General" tab of the "Tools | Options..." window of Atlantis is used.

So Atlantis currently does not retrieve the Author name from the filename of the source document. If everyone named document files in "your way" (I mean "<author name> - <book title>.<file extension>"), it would be fairly easy to adjust the "Batch conversion" feature of Atlantis to retrieve this information from names of source document files.
awp is offline   Reply With Quote
Old 03-09-2010, 05:26 PM   #55
Fith
Enthusiast
Fith began at the beginning.
 
Posts: 36
Karma: 10
Join Date: Feb 2010
Device: BeBook Neo / Onyx Boox 60
Thanks for that response AWP

How about frabjous and adikira, I know that batch files can (but can't remember how) parse the files name, but can you pass that to Calibre to enter the Author and Title Fields automatically.
Fith is offline   Reply With Quote
Old 03-09-2010, 06: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
Old 03-10-2010, 04:21 AM   #57
Fith
Enthusiast
Fith began at the beginning.
 
Posts: 36
Karma: 10
Join Date: Feb 2010
Device: BeBook Neo / Onyx Boox 60

That worked great. Saved me a lot of (immediate) reading

I use batch/dos so rarely any more that I have to learn all over again when I need it. Its so useful and quick, when you know how. E.G concatenating text files...

I should now be able to adapt your scripts to my needs. Always easier from a working example.

Last edited by Fith; 03-10-2010 at 04:28 AM.
Fith is offline   Reply With Quote
Old 04-22-2010, 04:16 PM   #58
abjdiat
Enthusiast
abjdiat began at the beginning.
 
Posts: 32
Karma: 10
Join Date: Oct 2009
Device: Nook
thanx frabjous, batching make life much easier
i tried first using the one line command but it didn't work,
adding sleep 30 did the magic,
much appreciated
abjdiat is offline   Reply With Quote
Old 07-05-2010, 05:20 AM   #59
moon face
Junior Member
moon face began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Jul 2010
Device: ipad
frabjous,

i did the same what you say to Laura81

Quote:
Laura,

No, what I'm suggesting is a single batch file that will both batch convert your .doc files to .html and then batch convert the .html files to .epub files.

As I noted, the batch file is two lines long:


Code:
for %%I in (*.doc) do "C:\Program Files (x86)\AbiWord\bin\AbiWord.exe" --to=html "%%I"
for %%I in (*.html) do "C:\Program Files (x86)\Calibre2\ebook-convert.exe" "%%I" "%%~nI.epub"Here's what you need to do:

1. Download and install AbiWord. It's completely free.
2. Download and install calibre. It's completely free.
3. Copy and paste the two lines above into Notepad, and save a file named "doc2epub.bat" or anything else whose name you'll remember ending in .bat. Save it in the same folder where your .doc files are.

The lines assume you're using a 64-bit operating system. If not, then use this instead:


Code:
for %%I in (*.doc) do "C:\Program Files\AbiWord\bin\AbiWord.exe" --to=html "%%I"
for %%I in (*.html) do "C:\Program Files\Calibre2\ebook-convert.exe" "%%I" "%%~nI.epub"The only difference is where the .exe files are located. You'll probably want to double check that the programs got installed in the same directories that mine were. I cannot test on a 32-bit version of windows, since I don't have access to one.


4. Navigate in Windows explorer to the folder where your .doc files are, and double click on "doc2epub".

The batch file will convert all the .doc files in the folder to html, and then convert all the .html files to .epub.

There's a lot of tweaking that can be done there to make the script better, especially with regard to how it handles filenames, metadata, etc., but it's hard for me to predict without knowing what your files are like. You might just want to cut and paste the FIRST line, and run that. That will batch convert your files to HTML. You then might want to use the graphical user interface in calibre to batch convert the HTML to ePub. That's really up to you.
__________________
DRM = ☹

--------------------------------------------------------------------------------
Last edited by frabjous; 02-01-2010 at 03:57 PM.
I leave it for more than 2 day, only 4 files from 128 are converted to epub..
>>>>>>>>>>>>>>>>>>>

Laura81,


how mony days it take from you to converte your docs??
moon face is offline   Reply With Quote
Old 07-05-2010, 11:59 AM   #60
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
Quote:
Originally Posted by moon face View Post
frabjous,

how mony days it take from you to converte your docs??
What? Two days? Why on Earth would you let it run for two days? It shouldn't take more than 15 minutes, unless these are super-long documents, or your computer is positively ancient.

Obviously something has gone wrong. It’s impossible for me to tell what’s gone wrong, because you didn’t provide any information about what happened.

Were the html files created for all the docs?
frabjous is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Hebrew Doc file to epub logie072 ePub 3 08-27-2010 11:31 AM
need advice doc/html to epub ebooker Workshop 2 08-14-2010 10:06 PM
Converting .doc to epub . . . michael180 General Discussions 2 06-08-2010 08:54 PM
Doc to Epub convertion problems johnbajer Calibre 5 06-04-2010 05:30 PM
Problem converting doc to epub Laura81 Calibre 3 01-26-2010 06:03 PM


All times are GMT -4. The time now is 06:42 PM.


MobileRead.com is a privately owned, operated and funded community.