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

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 01-07-2019, 02:33 AM   #1
nqk
Addict
nqk has learned how to buy an e-book online
 
Posts: 278
Karma: 92
Join Date: Feb 2012
Device: Samsung Galaxy Tab 8.9
Open With (.bat): How does it work?

Dear Kovid,

I would like to use a .cmd file (or .bat) to run script on the epub (basically to push it to Content Server (linux). Normally I can drag the file on to the .bat file and it runs fine. But when I use Openwith feature (not the plugin), it does nothing.

This is a simple sample:

Code:
@echo off
cls

echo %1

timeout /t 5
exit
nqk is offline   Reply With Quote
Old 01-07-2019, 07:34 AM   #2
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: 33,920
Karma: 10254168
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
should work just like that, but I dont currently have access to a windows computer to test.
kovidgoyal is online now   Reply With Quote
Advert
Old 01-07-2019, 08:51 AM   #3
chaley
CC Android & calibre dev
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 8,832
Karma: 2692874
Join Date: Jan 2010
Location: France
Device: Many android devices
Quote:
Originally Posted by kovidgoyal View Post
should work just like that, but I dont currently have access to a windows computer to test.
The above script works fine on my Win10 machine. When I drag a book from calibre I see the filename echoed, it counts down 5 seconds, then it closes.
Attached Thumbnails
Click image for larger version

Name:	Clipboard02.jpg
Views:	28
Size:	33.6 KB
ID:	168904  
chaley is offline   Reply With Quote
Old 01-07-2019, 10:38 AM   #4
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: 33,920
Karma: 10254168
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I think the OP is saying it works with drag and drop but not with open with (which you access by right lcicking the format in the book details panel and choosing open with)
kovidgoyal is online now   Reply With Quote
Old 01-07-2019, 10:54 AM   #5
nqk
Addict
nqk has learned how to buy an e-book online
 
Posts: 278
Karma: 92
Join Date: Feb 2012
Device: Samsung Galaxy Tab 8.9
Yes, that is what I am trying to do.
nqk is offline   Reply With Quote
Advert
Old 01-07-2019, 02:09 PM   #6
chaley
CC Android & calibre dev
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 8,832
Karma: 2692874
Join Date: Jan 2010
Location: France
Device: Many android devices
Yea, "open with" doesn't work with bat files. It doesn't execute the bat file. I played with the source for a while and couldn't make it work.
chaley is offline   Reply With Quote
Old 01-07-2019, 02:32 PM   #7
GreyWolfsGhost
Enthusiast
GreyWolfsGhost ought to be getting tired of karma fortunes by now.GreyWolfsGhost ought to be getting tired of karma fortunes by now.GreyWolfsGhost ought to be getting tired of karma fortunes by now.GreyWolfsGhost ought to be getting tired of karma fortunes by now.GreyWolfsGhost ought to be getting tired of karma fortunes by now.GreyWolfsGhost ought to be getting tired of karma fortunes by now.GreyWolfsGhost ought to be getting tired of karma fortunes by now.GreyWolfsGhost ought to be getting tired of karma fortunes by now.GreyWolfsGhost ought to be getting tired of karma fortunes by now.GreyWolfsGhost ought to be getting tired of karma fortunes by now.GreyWolfsGhost ought to be getting tired of karma fortunes by now.
 
Posts: 33
Karma: 1681374
Join Date: Jan 2018
Location: Great White North
Device: Glowlight 3, Kindle Keyboard, android, apple...
I would add a short cut to the batch file in the sent to of the right click menu.

Run "shell:sendto" then past shortcut into the folder.
GreyWolfsGhost is offline   Reply With Quote
Old 01-07-2019, 04:59 PM   #8
BetterRed
null operator
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 11,858
Karma: 10633600
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by GreyWolfsGhost View Post
I would add a short cut to the batch file in the sent to of the right click menu.

Run "shell:sendto" then past shortcut into the folder.
How do you get the calibre Open With to use the .lnk file in shell:sendto to exec the bat file.

@nqk - I have a vague memory that something the Open With plugin can do, that the built-in Open With can't do, is execute .bat files - but I am by no means certain. Give it a try.

BR
BetterRed is offline   Reply With Quote
Old 01-07-2019, 07:44 PM   #9
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 5,357
Karma: 24486886
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Aura One, Aura H2O, Aura HD, Nexus 7 HD, iPad Air, Tolino epos
Quote:
Originally Posted by BetterRed View Post
How do you get the calibre Open With to use the .lnk file in shell:sendto to exec the bat file.

@nqk - I have a vague memory that something the Open With plugin can do, that the built-in Open With can't do, is execute .bat files - but I am by no means certain. Give it a try.

BR
Not sure about this but I have a vague memory the last time I tried opening a .bat/.cmd file with Open With, it spit out a error about cmdline not being defined. Could be an error on my part in configuring the entry and not important enough that I spent time trying to troubleshoot it. I think this broke around the time that v1.52 or 1.53 was released.

Last edited by DNSB; 01-07-2019 at 08:10 PM.
DNSB is offline   Reply With Quote
Old 01-07-2019, 11:49 PM   #10
nqk
Addict
nqk has learned how to buy an e-book online
 
Posts: 278
Karma: 92
Join Date: Feb 2012
Device: Samsung Galaxy Tab 8.9
Quote:
Originally Posted by GreyWolfsGhost View Post
I would add a short cut to the batch file in the sent to of the right click menu.

Run "shell:sendto" then past shortcut into the folder.
This trick works, but it still requires the use of Windows Explorer. I'm hoping to use the built-in OpenWith feature of Calibre. Very convenient.

@BetterRed, I've tried the OpenWith plugin, but it did not work out.
nqk is offline   Reply With Quote
Old 01-08-2019, 01:26 AM   #11
BetterRed
null operator
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 11,858
Karma: 10633600
Join Date: Mar 2012
Location: Sydney Australia
Device: none
FWIW - the JobSpy plugin has a tool to run arbitrary programs, including .bat files, viz

Click image for larger version

Name:	1.jpg
Views:	25
Size:	237.0 KB
ID:	168917

But it doesn't pass arguments, so maybe Open With could adopt whatever it does, or JobSpy could be enhanced to pass an argument.

BR
BetterRed is offline   Reply With Quote
Old 01-09-2019, 12:40 AM   #12
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: 33,920
Karma: 10254168
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Open a ticket for it and I will look into it when I have a moment.
kovidgoyal is online now   Reply With Quote
Old 01-09-2019, 12:44 AM   #13
BetterRed
null operator
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 11,858
Karma: 10633600
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by kovidgoyal View Post
Open a ticket for it and I will look into it when I have a moment.
Done ==>> https://bugs.launchpad.net/calibre/+bug/1811045

BR
BetterRed is offline   Reply With Quote
Old 01-09-2019, 12:58 AM   #14
nqk
Addict
nqk has learned how to buy an e-book online
 
Posts: 278
Karma: 92
Join Date: Feb 2012
Device: Samsung Galaxy Tab 8.9
Quote:
Originally Posted by BetterRed View Post
Gosh. That's great. Thank you.
nqk 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
[Linux] "Click to open" links don't work drawson1 Calibre 2 01-28-2017 09:00 PM
Why would a book PDF work ok as a file, but not open in Calibre? willbeaufoy Calibre 3 07-13-2016 03:43 PM
Touchscreen not work when open device. Lenorav Amazon Kindle 4 05-23-2015 08:35 PM
[bug] problem using calibreportable.bat Dopedangel Calibre 4 12-22-2010 04:47 AM
Humor Wodehouse, P.G.: The Gold Bat. v1. 2 Jul 07 HarryT BBeB/LRF Books (offline) 0 07-02-2007 08:45 AM


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


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