Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Formats > Kindle Formats

Notices

Reply
 
Thread Tools Search this Thread
Old 04-27-2010, 08:56 AM   #1
pdurrant
The Ghost Mouse
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 32,184
Karma: 88959342
Join Date: Jul 2007
Location: Norfolk, England
Device: NOOK ST GlowLight
Applescript Wrapper Application for Kindlegen

KindleGen is a Mac OS X 10.5 and above Intel-only program from Amazon that compiles ebook source files into a Kindle format ebook.

Unfortunately, it's a command-line program that normally needs to be run by typing commands using the Terminal utility.

So I wrote an Applescript wrapper for Kindlegen. To use it, download and expand the attached zip file, which will give you the KindleGen Wrapper 2.2.app Applescript application. You can put this anywhere — perhaps in your Applications folder.

You'll also need the Mac OS X version of Kindlegen from Amazon, which can be found here: http://www.amazon.com/gp/feature.html?docId=1000234621.

Expand the zip file from Amazon, which will give you a folder containing the kindlegen command-line application (called just "kindlegen") and a variety of notes and samples. I suggest you drag the kindlegen command-line application into the Applications folder.

To use the Applescript, just drag&drop an ePub file or a folder containing a suitable set of Kindle source files onto the KindleGen Wrapper Applescript.

For ePubs the kindle file will be created in the same folder as the ePub, with the same name but with a ".mobi" extension.
For folders, the Applescript will run KindleGen on the first .opf file it finds in any folder (including in subfolders), and create the compiled Kindle file in the folder that contains the folder that was dragged, named the same as the folder that was dragged, but with a ".mobi" extension.

You can drag multiple folders and/or ePub files at once.

Because the Applescript searches subfolders, it's possible to arrange your source files so that they are both a valid ePub folder, and valid source files for a Kindle file, and generate the Kindle file with this AppleScript, and the ePub file using my ePub Zip applescript.

If you just run the AppleScript by double-clicking it you'll be able to choose whether kindlegen is run with the 'don't append source' option, with no compression (fast) or high compression (small). You'll also be shown which kindlegen command line application is being used, and be given an opportunity to choose a new one.

Comments, bug reports, etc., welcome.

This script now works only with kindlegen 1.2 and above, including the latest kindlegen 2.9. The option to not include source files will only work with later versions of KindleGen (2.0 and above?).

If you want to split out the Mobipocket and KF8 versions of the compiled file, see the KindleUnpack python script and AppleScript.

New to version 2.0:
  • Configuration Dialogs improved
  • Compilation option (Fast/Small) is now a default. You can reverse the default by holding down the option key when drag&dropping.
  • You can (if you wish) put the kindlegen command line application inside the KindleGen Wrapper package, in the Resources folder. The configuration dialogs will notice that it's there and give you the option of selecting it.

New to version 2.1
  • Pretty icon

New to version 2.2
  • Apped option to not attach source, since that command line option is supported again.
Attached Thumbnails
Click image for larger version

Name:	kindlegen.png
Views:	204
Size:	160.1 KB
ID:	94658  
Attached Files
File Type: zip KindleGen Wrapper 2.2.app.zip (294.2 KB, 301 views)

Last edited by pdurrant; 05-03-2014 at 05:13 AM.
pdurrant is offline   Reply With Quote
Old 09-01-2010, 07:33 AM   #2
nathalil
Junior Member
nathalil began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Sep 2010
Device: none
Hi pdurrant,
thank you very much for putting all this infos and zips here, but I still don't get it.

From Amazon I got a ZIP, unpacked it and dragged it to the Application Folder.
I also dragged the unpacked Kindlegen 1.1 app in applications and dragged it on Appleskript.

What's next?
or what did I do wrong?

When I try to compile my book with eCub it says:
*** Compilation failed.
The kindlegen command was empty. MobiPocket file not generated.

how do I generate this command?

when I type ~/KindleGen/kindlegen
it says: No such file or directory

despair.
thanks
nathalil is offline   Reply With Quote
Old 09-01-2010, 08:13 AM   #3
pdurrant
The Ghost Mouse
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 32,184
Karma: 88959342
Join Date: Jul 2007
Location: Norfolk, England
Device: NOOK ST GlowLight
Quote:
Originally Posted by nathalil View Post
When I try to compile my book with eCub it says:
*** Compilation failed.
The kindlegen command was empty. MobiPocket file not generated.

how do I generate this command?

when I type ~/KindleGen/kindlegen
it says: No such file or directory
This Applescript is nothing to do with eCub. If you want to use KindleGen with eCub, check the eCub documentation.

This Applescript allows you to drag&drop a folder of ePub source (what you get by unzipping an ePub) onto the AppleScript to run KindleGen on the .opf file in that ePub source folder.

Last edited by pdurrant; 07-30-2011 at 06:12 PM. Reason: Removed out of date info
pdurrant is offline   Reply With Quote
Old 07-30-2011, 07:07 AM   #4
pdurrant
The Ghost Mouse
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 32,184
Karma: 88959342
Join Date: Jul 2007
Location: Norfolk, England
Device: NOOK ST GlowLight
Significantly upgraded the script to work with the latest kindlegen 1.2, and to give you the option of compiling quickly, or compiling small files.

See the first post for the new AppleScript.

[EDIT: Applescript should now run in 10.5, 10.6 and 10.7.]

Last edited by pdurrant; 07-30-2011 at 06:13 PM.
pdurrant is offline   Reply With Quote
Old 08-26-2011, 09:57 AM   #5
gdgibson
Member
gdgibson began at the beginning.
 
Posts: 17
Karma: 10
Join Date: Apr 2011
Device: All
Thanks!

This is the first time I have ever gotten Kindlegen to work on my Mac. I don't know what I've been doing wrong - probably some weird thing I don't understand in Terminal - but now I finally have a way to produce Mobi files without Calibre.

(Not that there's anything wrong with Calibre, but it's nice to be able to convert without it as a means of debugging.)
gdgibson is offline   Reply With Quote
Old 02-15-2012, 04:02 PM   #6
amyg
Enthusiast
amyg is on a distinguished road
 
Posts: 39
Karma: 56
Join Date: Sep 2011
Location: Los Angeles, CA
Device: Nook simple touch, iPad
I would love an updated version of this applescript to run the new kindlegen 2.3 that I just downloaded. I tried using this one and it didn't work. I was able to edit pdurrant's lovely applescript wrapper for epubcheck to work with the new version of that, but, alas, I am too much of an applescript novice to edit this one myself.

Edit: Actually, it does run (just takes longer than the old one) and creates the mobi file, but I get an error message: The variable opfFilePath is not defined. But the mobi file looks fine so maybe I don't need a new one.

Last edited by amyg; 02-15-2012 at 04:31 PM. Reason: Further testing
amyg is offline   Reply With Quote
Old 06-03-2012, 05:30 PM   #7
pdurrant
The Ghost Mouse
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 32,184
Karma: 88959342
Join Date: Jul 2007
Location: Norfolk, England
Device: NOOK ST GlowLight
Quote:
Originally Posted by amyg View Post
I would love an updated version of this applescript to run the new kindlegen 2.3 that I just downloaded.
A new version has just been uploaded. This fixes the problem with the opfFilePath undefined error message, and removes explicit references to kindlegen 1.2, as it also works with later versions.
pdurrant is offline   Reply With Quote
Old 06-18-2012, 12:26 PM   #8
amyg
Enthusiast
amyg is on a distinguished road
 
Posts: 39
Karma: 56
Join Date: Sep 2011
Location: Los Angeles, CA
Device: Nook simple touch, iPad
Thanks for this. Works like a charm!
amyg is offline   Reply With Quote
Old 09-29-2012, 07:52 AM   #9
pdurrant
The Ghost Mouse
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 32,184
Karma: 88959342
Join Date: Jul 2007
Location: Norfolk, England
Device: NOOK ST GlowLight
Just updated to version 2.0

New to version 2.0:
  • Configuration Dialogs improved
  • Compilation option (Fast/Small) is now a default. You can reverse the default by holding down the option key when drag&dropping.
  • You can (if you wish) put the kindlegen command line application inside the KindleGen Wrapper package, in the Resources folder. The configuration dialogs will notice that it's there and give you the option of selecting it.

See the first post for the download.
pdurrant is offline   Reply With Quote
Old 10-22-2012, 09:49 AM   #10
pdurrant
The Ghost Mouse
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 32,184
Karma: 88959342
Join Date: Jul 2007
Location: Norfolk, England
Device: NOOK ST GlowLight
Just updated to version 2.1

New to version 2.1:
  • Pretty Icon

See the first post for the download.

(Yes, I have done an update for just the icon. I've found using ePub Zip/Unzip, epubcheck and MobiUnpack a lot easier since I added icons.)
pdurrant is offline   Reply With Quote
Old 03-13-2013, 08:20 PM   #11
ynots
Junior Member
ynots began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Mar 2013
Device: Kindle, iPad
Hello, I was wondering if your program works on Mountain Lion? I enabled the settings to allow apps not from the Apps store to run but nothing happens when I drag and drop my epub exported from Pages to your KindleGen Wrapper. I kept the KindleGen in the Applications folder as well as inside KindleGen Wrapper's Resources folder. Any ideas on what I can try next?

A quick run- down of my situation...
I styled and tagged four 185 page long epub which is a compilation of articles categorized in 5 sections using Pages. I found out after doing this unfortunately, that font sizes, space between paragraphs, and the TOC gets screwed up once exported as ePub. I kept it pretty simple with styles: Title (for title of sections), Heading 1 (for title of articles), Heading 2 (for sub-sections within articles) article Title, Body (for body text). I inserted graphics for the beginning of each section. The TOC that was created in Pages disappeared when viewed on a Kindle.

The process has been nothing but frustration and headache after headache!

I'm not even sure if your software remedies my problems but at this point I'd like to try any and your solution sounded good because it's the only way I could use Amazon's KindleGen script which they recommend we use...

Thank you for any help.
ynots is offline   Reply With Quote
Old 03-14-2013, 04:43 AM   #12
pdurrant
The Ghost Mouse
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 32,184
Karma: 88959342
Join Date: Jul 2007
Location: Norfolk, England
Device: NOOK ST GlowLight
Quote:
Originally Posted by ynots View Post
Hello, I was wondering if your program works on Mountain Lion?
Well, it works for me, so it can run on Mountain Lion.

What happens if you double-click it? You should get asked whether you want it to compile Fast or Small, and then get to choose which kindlegen it uses.

When you drag&drop, do you get a text file produced? that would show what's happening when it tries to run kindlegen
pdurrant is offline   Reply With Quote
Old 03-14-2013, 02:02 PM   #13
ynots
Junior Member
ynots began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Mar 2013
Device: Kindle, iPad
As you say, double click asks whether I want to compile Fast or Small and choose which kindlegen to use. I've tried both.

Drag and drop doesn't produce any text file that I can see. Where would the text file be outputted by default?
edit: I tried using a different epub file with only a couple words in it and outputted a .txt file. Inside says, : Permission denied
ynots is offline   Reply With Quote
Old 03-14-2013, 02:07 PM   #14
pdurrant
The Ghost Mouse
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 32,184
Karma: 88959342
Join Date: Jul 2007
Location: Norfolk, England
Device: NOOK ST GlowLight
Quote:
Originally Posted by ynots View Post
As you say, double click asks whether I want to compile Fast or Small and choose which kindlegen to use. I've tried both.

Drag and drop doesn't produce any text file that I can see. Where would the text file be outputted by default?
edit: I tried using a different epub file with only a couple words in it and outputted a .txt file. Inside says, : Permission denied
That sounds like something is stopping the KindleGen application from running.

Umm... you have unzipped the Kindlegen downloaded from Amazon and pointed the AppleScript at the Kindlegen file inside the unzipped folder, haven't you? You haven't just pointed it at the Kindlegen zip file?
pdurrant is offline   Reply With Quote
Old 04-26-2014, 02:33 PM   #15
pdurrant
The Ghost Mouse
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 32,184
Karma: 88959342
Join Date: Jul 2007
Location: Norfolk, England
Device: NOOK ST GlowLight
Just uploaded version 2.2 of the wrapper, which restores the ability to not add the source to the end of the generated book, for versions of kindlegen that support that option (e.g. the latest version 2.9 of Kindlegen).
pdurrant is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ePub Zip/Unzip AppleScript application for Mac OS X pdurrant ePub 95 08-29-2014 08:41 PM
Kindlestrip Python script and AppleScript wrapper pdurrant Kindle Formats 133 07-11-2014 07:18 AM
KindleCover: AppleScript wrapper and Python script application pdurrant Amazon Kindle 6 12-02-2012 07:14 AM


All times are GMT -4. The time now is 07:10 AM.


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