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

Go Back   MobileRead Forums > E-Book Software > Calibre > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 08-14-2012, 05:31 PM   #136
GRiker
Comparer of the Ephemeris
GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.
 
Posts: 1,497
Karma: 424627
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
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:
Code:
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 column, type:
Code:
/usr/bin/launch_kindle_previewer
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.

G
Attached Images
 

Last edited by GRiker; 08-16-2012 at 10:08 AM.
GRiker is offline   Reply With Quote
Old 08-15-2012, 09:13 AM   #137
loximuthal
Connoisseur
loximuthal has not lost his or her sense of wonder.loximuthal has not lost his or her sense of wonder.loximuthal has not lost his or her sense of wonder.loximuthal has not lost his or her sense of wonder.loximuthal has not lost his or her sense of wonder.loximuthal has not lost his or her sense of wonder.loximuthal has not lost his or her sense of wonder.loximuthal has not lost his or her sense of wonder.loximuthal has not lost his or her sense of wonder.loximuthal has not lost his or her sense of wonder.loximuthal has not lost his or her sense of wonder.
 
loximuthal's Avatar
 
Posts: 75
Karma: 86158
Join Date: Jan 2011
Location: Maryland
Device: NST, Kindle Fire, iPad2
Thumbs up

Quote:
Originally Posted by GRiker View Post
The most recent version of the Open With plugin has the ability to run shell scripts instead of apps under OS X. ... I finally decided to solve this annoyance.
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.
loximuthal is offline   Reply With Quote
Old 08-16-2012, 08:44 AM   #138
loximuthal
Connoisseur
loximuthal has not lost his or her sense of wonder.loximuthal has not lost his or her sense of wonder.loximuthal has not lost his or her sense of wonder.loximuthal has not lost his or her sense of wonder.loximuthal has not lost his or her sense of wonder.loximuthal has not lost his or her sense of wonder.loximuthal has not lost his or her sense of wonder.loximuthal has not lost his or her sense of wonder.loximuthal has not lost his or her sense of wonder.loximuthal has not lost his or her sense of wonder.loximuthal has not lost his or her sense of wonder.
 
loximuthal's Avatar
 
Posts: 75
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.
loximuthal is offline   Reply With Quote
Old 08-16-2012, 09:35 AM   #139
GRiker
Comparer of the Ephemeris
GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.
 
Posts: 1,497
Karma: 424627
Join Date: Mar 2009
Device: iPad
Quote:
Originally Posted by loximuthal View Post
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.
Increase the delay before sending the return key. I tweaked the values based on my system, ymmv.

Code:
(* Allow time for the filespec to be entered *)
        delay 3
G
GRiker is offline   Reply With Quote
Old 08-16-2012, 09:54 AM   #140
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 9,515
Karma: 43764640
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 09:58 AM.
DiapDealer is online now   Reply With Quote
Old 08-16-2012, 10:07 AM   #141
GRiker
Comparer of the Ephemeris
GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.
 
Posts: 1,497
Karma: 424627
Join Date: Mar 2009
Device: iPad
Quote:
Originally Posted by DiapDealer View Post
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).
Apparently an OS X-only issue if it's working for you in Windows.

G
GRiker is offline   Reply With Quote
Old 08-16-2012, 06:36 PM   #142
loximuthal
Connoisseur
loximuthal has not lost his or her sense of wonder.loximuthal has not lost his or her sense of wonder.loximuthal has not lost his or her sense of wonder.loximuthal has not lost his or her sense of wonder.loximuthal has not lost his or her sense of wonder.loximuthal has not lost his or her sense of wonder.loximuthal has not lost his or her sense of wonder.loximuthal has not lost his or her sense of wonder.loximuthal has not lost his or her sense of wonder.loximuthal has not lost his or her sense of wonder.loximuthal has not lost his or her sense of wonder.
 
loximuthal's Avatar
 
Posts: 75
Karma: 86158
Join Date: Jan 2011
Location: Maryland
Device: NST, Kindle Fire, iPad2
Quote:
Originally Posted by GRiker View Post
Increase the delay before sending the return key. I tweaked the values based on my system, ymmv.
That did the trick. I bumped it up to 5 and it works fine. I think part of the issue may be that the particular book I chose to test this script on has a longer than average file path name, so three seconds was not long enough for all the characters to be 'typed' in.

Muchas gracias!
loximuthal is offline   Reply With Quote
Old 08-23-2012, 01:28 AM   #143
g63marty
Junior Member
g63marty began at the beginning.
 
g63marty's Avatar
 
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
g63marty is offline   Reply With Quote
Old 08-23-2012, 08:08 AM   #144
josepinto
Enthusiast
josepinto began at the beginning.
 
Posts: 45
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
josepinto is offline   Reply With Quote
Old 08-23-2012, 12:49 PM   #145
theducks
Grand Sorcerer
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 15,229
Karma: 5955195
Join Date: Aug 2009
Location: (The original) Silicon Valley, USA
Device: Galaxy Tab 2, Astak Pocket Pro, K4NT
Quote:
Originally Posted by josepinto View Post
Hi,

Can you add open with SumatraPDF Reader for epub, pdf and mobi files?

Kind regards,

José Pinto
You can do that yourself with the configure settings
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
theducks is offline   Reply With Quote
Old 08-23-2012, 03:50 PM   #146
josepinto
Enthusiast
josepinto began at the beginning.
 
Posts: 45
Karma: 10
Join Date: Apr 2005
Device: Nokia 5320
Done

Quote:
Originally Posted by theducks View Post
You can do that yourself with the configure settings
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
Done for Mobi, EPUB and PDF open with SumatraPDF Portable.

Thank You

José Pinto
josepinto is offline   Reply With Quote
Old 09-30-2012, 09:04 PM   #147
kiwidude
calibre/Sigil Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,230
Karma: 1345754
Join Date: Oct 2010
Location: London, UK
Device: Kindle Paperwhite 3G, iPad 3, iPad Air
v1.5.5 Released

Changes in this release:
  • Put a special case in for loading Sigil, to workaround issues found with 0.5.9 release and conflicting C runtime paths

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 01:45 PM.
kiwidude is offline   Reply With Quote
Old 10-29-2012, 01:36 PM   #148
weedfreak
Addict
weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.
 
weedfreak's Avatar
 
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?
weedfreak is offline   Reply With Quote
Old 10-29-2012, 01:49 PM   #149
kiwidude
calibre/Sigil Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,230
Karma: 1345754
Join Date: Oct 2010
Location: London, UK
Device: Kindle Paperwhite 3G, iPad 3, iPad Air
@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.
kiwidude is offline   Reply With Quote
Old 10-29-2012, 03:18 PM   #150
weedfreak
Addict
weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.
 
weedfreak's Avatar
 
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.
weedfreak 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
[GUI Plugin] Search the Internet kiwidude Plugins 205 08-11-2014 03:22 PM
New Plugin Type Idea: Library Plugin cgranade Plugins 3 09-15-2010 01:11 PM
Gui confusements. brewt Calibre 8 12-30-2008 01:16 PM
Reference Open eBook Forum: Open eBook Publication Structure. IMP. V1.0.1 14 September 2007 DaleDe IMP Books 0 09-14-2007 06:06 PM
iLiad GUI for the iLiad tribble iRex Developer's Corner 1 06-01-2007 03:29 PM


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


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