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 12-10-2012, 05:59 AM   #166
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,774
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I'd guess it's because the CRT was manifest-less in the Sigil build and CreateProcess does not sanitize the PATH variable. Changing the cwd and removing the calibre install dir from the path should take care of it.
kovidgoyal is online now   Reply With Quote
Old 12-10-2012, 06:10 AM   #167
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,601
Karma: 2092290
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
@Kovid - yeah clearing the path variable was what I had done in my Sigil hack workaround that uses subprocess.Popen(). However at the time I couldn't figure out a way to clear the path that worked with CreateProcess(). Since I was neck deep in Sigil development for 0.6.0 in the end I gave up and just chucked in the subprocess.Popen hack to just get something out there so people could at least use Open With to test the 0.5.9 betas.
kiwidude is offline   Reply With Quote
Old 12-10-2012, 06:36 AM   #168
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,774
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You'd need to create the lpEnvironment and pass it to createprocess. Something like

env = os.environ.copy()
# remove the calibre path from env['PATH']

raw = u'\0'.join(u'%s=%s'%(k, v) for k, v in env.iteritems())

Then pass raw as lpEnvironment to CreateProcess and remember to set CREATE_UNICODE_ENVIRONMENT in the dwCreationFlags
kovidgoyal is online now   Reply With Quote
Old 12-10-2012, 06:44 AM   #169
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,601
Karma: 2092290
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
Thanks for that. Something resembling that code wasn't amongst my guesses at the time that I can recall - in the end I got grumpy and cheated
kiwidude is offline   Reply With Quote
Old 12-10-2012, 08:04 PM   #170
Neck Beard
Member
Neck Beard began at the beginning.
 
Posts: 10
Karma: 10
Join Date: Dec 2012
Device: none
Hello, I was wondering if anyone has used the 'open with' plugin to push pdf's to an ocr program? I am currently trying to get it to work with FreeOCR on Windows. I have created a customized menu option, however, when it opens FreeOCR it does not open the pdf. It essentially just launches FreeOCR without loading my pdf. Perhaps modifying the application path from "C:\FreeOCR\FreeOCR.exe" could help but I can't figure it out.
Neck Beard is offline   Reply With Quote
Old 12-10-2012, 08:15 PM   #171
theducks
Well trained by Cats
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: 29,689
Karma: 54369090
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by Neck Beard View Post
Hello, I was wondering if anyone has used the 'open with' plugin to push pdf's to an ocr program? I am currently trying to get it to work with FreeOCR on Windows. I have created a customized menu option, however, when it opens FreeOCR it does not open the pdf. It essentially just launches FreeOCR without loading my pdf. Perhaps modifying the application path from "C:\FreeOCR\FreeOCR.exe" could help but I can't figure it out.
for Open with to work that way, the program needs to accept the filename(path) as part of the open command.

Not all programs accept this (Flightcrew does not, as an example)
theducks is offline   Reply With Quote
Old 12-14-2012, 04:26 AM   #172
asllearner
Enthusiast
asllearner began at the beginning.
 
Posts: 31
Karma: 10
Join Date: Aug 2011
Device: none
I am trying to add links to two programs in Open_With:
one is to BeCyPDFMetaEdit.exe

For some strange reason, this program requires administrator priviledges to run. I believe this is leading to the following error:

calibre, version 0.9.9
ERROR: Unhandled exception: <b>error</b>740, 'CreateProcess', 'The requested operation requires elevation.')

Traceback (most recent call last):
File "calibre_plugins.open_with.action", line 178, in open_with
File "calibre_plugins.open_with.action", line 221, in launch_app
error: (740, 'CreateProcess', 'The requested operation requires elevation.')

Is there a workaround? I am going to contact the author of BeCyPDFMetaEdit to find out about the elevated priviledges, but maybe someone knows a workaround?

(ps..I mean a workaround less of a kludge than running calibre in administrator mode...)

If I try to use the com version (which is not what I want, anyway), using a bat file
(
pause
C:/MyPrograms/BeCyPDFMetaEdit-2.37.0-en/BeCyPDFMetaEdit.exe
pause
)
the resulting dos window just flashes by too quickly for me to see why it failed.


Also, I am trying to use jpdftweak.
When I run this, from the bat file provided by the program (
pause
@java -jar jpdftweak.jar %*
pause
) the resulting dos window just flashes by too quickly for me to see why it failed, as above.

if I try to link to the jar file directly, I get:
calibre, version 0.9.9
ERROR: Unhandled exception: <b>error</b>193, 'CreateProcess', '%1 is not a valid Win32 application.')

Traceback (most recent call last):
File "calibre_plugins.open_with.action", line 178, in open_with
File "calibre_plugins.open_with.action", line 221, in launch_app
error: (193, 'CreateProcess', '%1 is not a valid Win32 application.')

Can I do anything about this?

Thanks in advance for any help.

PS. I have only moderate ability with batch files, python, and all that jazz so dont be afraid to offend me by dumbing it down :-)

Last edited by asllearner; 12-14-2012 at 04:48 AM. Reason: appended ps
asllearner is offline   Reply With Quote
Old 12-16-2012, 11:47 PM   #173
bauerhjb
Connoisseur
bauerhjb began at the beginning.
 
bauerhjb's Avatar
 
Posts: 52
Karma: 19
Join Date: Apr 2010
Location: northern Idaho, USA
Device: laptop, netbook, LG & Nextus tablets - Window 10, 8.1, 7,
The "open with" plug-in crashes calibre when trying to configure. I am using calibre ver. 09.9 on a machine running Vista. I am running the most recent version of open with. I have tried unstalling the plugin and restarting calibre, but no change, it still crashes when I try to open the configure menu, either from the preferences menu or from the button menu. I had configured the plugin previously and it worked fine with my earlier upgrades of calibre. Any suggestions? Thanks in advance for any help...
bauerhjb is offline   Reply With Quote
Old 04-02-2013, 05:19 PM   #174
pjeby
.
pjeby began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Apr 2013
Device: Various
Lightbulb DETACHED_PROCESS flag needed for Windows console programs

Hi, just wanted to report an issue with v1.5.6 (really 1.5.3 and up) for running console programs and scripts (such as batch files or Python scripts) on Windows. Basically, the CreateProcess call that's currently in the plugin doesn't allow the launched programs to create a valid console and so their input and output don't actually work. The program runs (I think) but the window just flashes up and disappears.

So, I changed the CreateProcess call in the plugin to read:

CreateProcess(None, cmd_line, None, None, False, DETACHED_PROCESS, None, None, si)

and moved the DETACHED_PROCESS definition so it covers both branches of the if, and this fixed the problem for me.

(As a side note, it's a little annoying that I can't just directly invoke .py, .bat, or .ahk scripts from the plugin; I have to specify the interpreter (python, cmd.exe, autohotkey.exe, etc.) and then pass the script as an argument. It might be nice to be able to just specify the script and let Windows take care of running the interpreter. Apart from that, great plugin!)
pjeby is offline   Reply With Quote
Old 04-15-2013, 10:00 AM   #175
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,601
Karma: 2092290
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
v1.5.7 released

Changes in this release:
  • Add detached process flag for when launching on Windows

Thanks pjeby for the suggestion. Can't remember why I changed this as I think I had this flag a long time ago, but if anyone notices an issue just report it here.
kiwidude is offline   Reply With Quote
Old 04-18-2013, 07:06 PM   #176
edwdecarlo
Enthusiast
edwdecarlo began at the beginning.
 
Posts: 37
Karma: 41
Join Date: Nov 2011
Location: North Kingstown, RI, USA
Device: Kindle DX,Nexus 10,Fire HD
Not Showing Image/Icon when New Image Added (cosmetic only)

Discovered something which does not effect functionality. This is just cosmetic, so not a big deal.

Running:
Win 7 (64-bit) - Fully up-to-date
Calibre v0.9.27
Open With v1.5.7

I have set up a Covers Open With for XnView. I am able to have the cover Open in XnView without any issues.

What I have noticed is that the Image/Icon I uploaded for this option does not appear where the images/icons do for the apps which have built in support (Sigil, Paint, ADE, etc). This includes on the Open With config screen and the Open With menu items.

When I do the 'Add New Image...', it does get copied to the Calibre [User]\AppData\Roaming\calibre\resources\images directory.

I have included screen shots of my Open With config and [User]\AppData\Roaming\calibre\resources\images dir. Note: the image I uploaded is 16 x 16.

Thanks.
Attached Thumbnails
Click image for larger version

Name:	OpenWithConfig.jpg
Views:	400
Size:	79.3 KB
ID:	104572   Click image for larger version

Name:	Explorer.jpg
Views:	403
Size:	56.6 KB
ID:	104573  
edwdecarlo is offline   Reply With Quote
Old 04-19-2013, 10:12 AM   #177
Aleyst
Zealot
Aleyst plays well with othersAleyst plays well with othersAleyst plays well with othersAleyst plays well with othersAleyst plays well with othersAleyst plays well with othersAleyst plays well with othersAleyst plays well with othersAleyst plays well with othersAleyst plays well with othersAleyst plays well with others
 
Posts: 109
Karma: 2800
Join Date: Jul 2010
Location: Australia
Device: PW (7th Gen), PW (10th Gen)
You need to remove owp_ from the filename, just use xnview by itself.

Not sure why it conflicts but i had the same problem, that fixes it
Aleyst is offline   Reply With Quote
Old 04-19-2013, 10:03 PM   #178
edwdecarlo
Enthusiast
edwdecarlo began at the beginning.
 
Posts: 37
Karma: 41
Join Date: Nov 2011
Location: North Kingstown, RI, USA
Device: Kindle DX,Nexus 10,Fire HD
Quote:
Originally Posted by Aleyst View Post
You need to remove owp_ from the filename, just use xnview by itself.

Not sure why it conflicts but i had the same problem, that fixes it
That did it.

edwdecarlo is offline   Reply With Quote
Old 04-20-2013, 10:21 AM   #179
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,601
Karma: 2092290
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
The purpose of the owp_ prefix is an internal use thing by the plugin. It was a way to allow the plugin to know to retrieve the image from the plugin zip file, rather than look for it in the resources directory. If you add an image with that owp_ prefix, the plugin will be looking for it in the zip, hence why it doesn't work whereas renaming and removing the prefix does.

One day I may look to implement it another way, but to be honest it never occurred to me that people would copy my prefix convention, that was why I made it fairly obscure
kiwidude is offline   Reply With Quote
Old 04-22-2013, 11:43 AM   #180
Neck Beard
Member
Neck Beard began at the beginning.
 
Posts: 10
Karma: 10
Join Date: Dec 2012
Device: none
Open With is greyed out

Hi,

Open with stopped working. I don't know what is wrong it was working fine then when I opened up Calibre today it wasn't. When I click on it every item in the drop down is greyed out except the customize plugin item.

Things I have tried in order to fix it are:
restart Calibre, didn't work
remove plugin and reinstall, didn't work (interestingly disable/enable plugin throws up an error says I can't disable don't know if this is normal or not for this plugin)
repair install of Calibre, didn't work

I am running Calibre x64 0.9.27 and Open With 1.5.7
Help!
Neck Beard is offline   Reply With Quote
Reply

Tags
conversion, kepubify

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 423 Today 06:53 AM
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


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


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