The most recent version of the Open With plugin has the ability to run shell scripts instead of apps under OS X. Why does this matter?
The Kindle Previewer app does a nice job of simulating the various Kindle devices, but, infuriatingly, it does not accept a file to open as an argument under OS X. I finally decided to solve this annoyance.
You can now use Open With to open Kindle Previewer with any of the file types it supports. I only care about MOBI and AZW3.
Here's how to do it.
1) Create a text file with the following contents:
# Execute Applescript telling Kindle Previewer to open passed file
# This file should be saved to /usr/bin/launch_kindle_previewer,
# then set as executable from Terminal by typing
# cd /usr/bin
# chmod +x launch_kindle_previewer
tell application "Kindle Previewer" to activate
tell application "System Events"
tell process "Kindle Previewer"
keystroke "o" using command down
(* Allow time for the filespec to be entered. Increase delay if file not opened *)
(* Close the dialog by pressing the Open button *)
(* Go to beginning - removes banner *)
keystroke "s" using command down
Save this file to /usr/bin/launch_kindle_previewer. This is the same directory where calibre stores its command line tools.
2) Set permissions on the file so that it can be executed. The following code assumes you're currently in /usr/bin:
chmod +x launch_kindle_previewer
3) Open the Customize Open With
dialog. Add a new entry for format MOBI, and a second entry for format AZW3. In the Application Path
The matching format of the currently selected book will be passed to the shell script you created above when invoked from the Open With plugin.
4) You can also add the matching icon to Open With (attached below).
Have fun watching AppleScript jam keystrokes down Kindle Previewer's throat.
If the dialog opens but the Open
key is not activated, try increasing the delay value.