08-14-2012, 04:31 PM | #136 |
Comparer of the Ephemeris
Posts: 1,496
Karma: 424697
Join Date: Mar 2009
Device: iPad
|
Using the Open With plugin to launch Kindle Previewer (OS X)
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: Code:
#!/bin/sh # 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 osascript <<EOF tell application "Kindle Previewer" to activate tell application "System Events" tell process "Kindle Previewer" keystroke "o" using command down keystroke "$1" keystroke return (* Allow time for the filespec to be entered. Increase delay if file not opened *) delay 3 (* Close the dialog by pressing the Open button *) keystroke return (* Go to beginning - removes banner *) keystroke "s" using command down end tell end tell EOF 2) Set permissions on the file so that it can be executed. The following code assumes you're currently in /usr/bin: Code:
chmod +x launch_kindle_previewer Code:
/usr/bin/launch_kindle_previewer 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. G Last edited by GRiker; 08-16-2012 at 09:08 AM. |
08-15-2012, 08:13 AM | #137 |
Connoisseur
Posts: 81
Karma: 86158
Join Date: Jan 2011
Location: Maryland
Device: NST, Kindle Fire, iPad2
|
Thank you!!!! This has also been annoying me, but I don't have the coding chops to sort this out. I'll be trying it this evening when I get home.
|
08-16-2012, 07:44 AM | #138 |
Connoisseur
Posts: 81
Karma: 86158
Join Date: Jan 2011
Location: Maryland
Device: NST, Kindle Fire, iPad2
|
Well, it almost did the job you described. It hung at the "keystroke return" step. Easy enough for me to manually hit the button, but it was kind of disappointing to get so close without completing the process.
Do you have any suggestions on what I should look at to see why this might have happened? As far as I can tell I followed your directions to the letter (copy/paste code into file in the specified directory; chmod per instructions; edited "Open With" config), but I'm not really up on AppleScript. |
08-16-2012, 08:35 AM | #139 | |
Comparer of the Ephemeris
Posts: 1,496
Karma: 424697
Join Date: Mar 2009
Device: iPad
|
Quote:
Code:
(* Allow time for the filespec to be entered *) delay 3 |
|
08-16-2012, 08:54 AM | #140 |
Grand Sorcerer
Posts: 27,568
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Is the Open With issue regarding KindlePreviewer only a problem with OSX? I only ask because the Windows version seem to accept a file as an argument just fine (actually, I don't need any arguments to get it to work with the Open With plugin).
Last edited by DiapDealer; 08-16-2012 at 08:58 AM. |
08-16-2012, 09:07 AM | #141 | |
Comparer of the Ephemeris
Posts: 1,496
Karma: 424697
Join Date: Mar 2009
Device: iPad
|
Quote:
G |
|
08-16-2012, 05:36 PM | #142 | |
Connoisseur
Posts: 81
Karma: 86158
Join Date: Jan 2011
Location: Maryland
Device: NST, Kindle Fire, iPad2
|
Quote:
Muchas gracias! |
|
08-23-2012, 12:28 AM | #143 |
Junior Member
Posts: 2
Karma: 10
Join Date: Aug 2012
Device: Kindle Touch
|
Incorrect default executable paths on win 7 x64
Hello!
I just started using your plugin, thank you! It seems to work okay... after a few modifications. On Windows 7 x64 using Caliber 0.8.65 and Open With plugin 1.5.4. Customize plugins. The paths for the 64 bit executables and 32 bit executables are reversed. 32 bit programs should be %ProgramFiles(x86)% (usually C:\Program Files (x86)\...) and 64 bit programs go in %ProgramFiles% (usually C:\Program Files\...) I know this is reversed from Windows 32 bit OSs which also uses %ProgramFiles% resulting in usually C:\Program Files\... I'm not sure why Microsoft did this. Hopefully Calibre plugins are allowed to detect the OS bit count? Then you could populate the list accordingly. If not, another option is to test for the windows environment variables IF %PROCESSOR_ARCHITECTURE% == x86 AND %PROCESSOR_ARCHITEW6432% NOT DEFINED THEN // OS is 32bit ELSE // OS is 64bit END IF Hope this helps! MartyG |
08-23-2012, 07:08 AM | #144 |
Connoisseur
Posts: 50
Karma: 10
Join Date: Apr 2005
Device: Nokia 5320
|
Open With SumatraPDF
Hi,
Can you add open with SumatraPDF Reader for epub, pdf and mobi files? Kind regards, José Pinto |
08-23-2012, 11:49 AM | #145 | |
Well trained by Cats
Posts: 29,839
Karma: 54837878
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
The list is just a 'seed' using common OS (platform) programs. Preference: Plugins: user interface actions: open with Click the 'Customize button' : there is built in Help in the Upper Right corner |
|
08-23-2012, 02:50 PM | #146 | |
Connoisseur
Posts: 50
Karma: 10
Join Date: Apr 2005
Device: Nokia 5320
|
Done
Quote:
Thank You José Pinto |
|
09-30-2012, 08:04 PM | #147 |
Calibre Plugins Developer
Posts: 4,637
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
v1.5.5 Released
Changes in this release:
For those of you using the Sigil 0.5.9 betas (and most like Sigil 0.6 when it is released) you may have noticed an error dialog appearing if you are running the 32-bit build on Windows, after which Sigil starts. Since we have been unable to resolve the issue from the Sigil side, I have placed a special case exemption into Open With to load Sigil using a different approach. So you should no longer see any errors with launch the 32-bit build of Sigil on Windows. Last edited by kiwidude; 10-12-2012 at 12:45 PM. |
10-29-2012, 12:36 PM | #148 |
Addict
Posts: 302
Karma: 185297
Join Date: Sep 2009
Location: Ankh Morpork
Device: calibre
|
Because of some inconsistencies with either sigil or arch linux the only way I can start sigil is from the cli "LC_ALL=en_GB.utf8 sigil" but I cannot get open with to work.
I assumed that setting the path to sigil and the arguments to LC_ALL=en_GB.utf8 would do the trick but the system tries to parse the argument as a programme and fails to open sigil. I assume my thinking is somewhat scrambled, would someone point me in the right direction? |
10-29-2012, 12:49 PM | #149 |
Calibre Plugins Developer
Posts: 4,637
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
@weedfreak - as you found you cannot set environment parameters using the plugin, only arguments to pass to the launched executable, which is not what you want.
I know next to nothing about Linux, my toes curl any time I am forced to use it. Can you not just set that environment variable in your script you use to launch calibre? Or does that LC_ALL setting interfere with calibre operation? Another option may be to just hack the plugin code for your own purposes, just edit action.py in the zip around line 213 to do whatever you need to do. |
10-29-2012, 02:18 PM | #150 |
Addict
Posts: 302
Karma: 185297
Join Date: Sep 2009
Location: Ankh Morpork
Device: calibre
|
I did not think it would be simple, the LC_ALL setting actually overwrite all the locale settings such as monetary values time etc. If I used en_US there would be no problem as that is the predefined setting for something in the sigil process. I will have a look at the calibre script, there might be something I could do there, though perhaps looking at the sigil script might be a better option.
|
Tags |
conversion, kepubify |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[GUI Plugin] Search the Internet | kiwidude | Plugins | 433 | 04-01-2024 05:48 PM |
New Plugin Type Idea: Library Plugin | cgranade | Plugins | 3 | 09-15-2010 12:11 PM |
Gui confusements. | brewt | Calibre | 8 | 12-30-2008 12:16 PM |
Reference Open eBook Forum: Open eBook Publication Structure. IMP. V1.0.1 14 September 2007 | DaleDe | IMP Books | 0 | 09-14-2007 05:06 PM |
iLiad GUI for the iLiad | tribble | iRex Developer's Corner | 1 | 06-01-2007 02:29 PM |