Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 12-11-2015, 12:16 PM   #1
Andys
Member
Andys began at the beginning.
 
Posts: 14
Karma: 10
Join Date: Mar 2015
Device: PC
Use filename without full path in 'open with'

Hi, this question is pretty hard to search, since it could be paraphrased in many different ways.
I am talking about 'Open With' function of Calibre library. If I understand correctly, there are no tags which could be substituted in command line with name, path, etc of opened file. Calibre simply adds full path of book file after all args.
What I want is to 1. change working directory to book directory and 2. run this command with filename of book only, without full path to it.
That is because I use external reader which saves bookmarks in separate file, but it creates it in 'working' folder, not in opened book folder. Development is stopped so I can't request a fix from it's creator.
I guess it would be possible to run cmd /c with required parameters IF there was a %filename% substitution tag but alas I didn't see anything like that in help.
Am I stuck?
Andys is offline   Reply With Quote
Old 12-11-2015, 12:25 PM   #2
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: 31,062
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Andys

If you ALWAYS want to use that external reader
and
as long as it is registered as the default for the file type with the OS (you can doubleclick that file type in the explorer and it opens in that reader)

Simply remove the Tic next to the type in Preferences: Behavior: Use Internal viewer for

The Calibre will use the OS to open that file type when you tap View (V)
theducks is offline   Reply With Quote
Advert
Old 12-11-2015, 01:01 PM   #3
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Should be as simple as setting the cwd to the parent directory of the ebook file.

I can't specifically think of any reason why that might be a bad idea, so, if you are talking about the plugin, here is a patch and a fixed copy that does just that.
Attached Files
File Type: zip Open With-cwd.zip (179.4 KB, 189 views)
File Type: txt Open With-changes.diff.txt (2.2 KB, 181 views)
eschwartz is offline   Reply With Quote
Old 12-11-2015, 01:38 PM   #4
Andys
Member
Andys began at the beginning.
 
Posts: 14
Karma: 10
Join Date: Mar 2015
Device: PC
Quote:
Originally Posted by eschwartz View Post
Should be as simple as setting the cwd to the parent directory of the ebook file.

I can't specifically think of any reason why that might be a bad idea, so, if you are talking about the plugin, here is a patch and a fixed copy that does just that.
Thanks, though I am not feeling safe modifying calibre files.

I got my solution through autoit exe, which acts as a cmd file - splits path and file name, CD's to path and runs my viewer.
I compiled it to exe and this works.
Code if anyone else will want this function in future, though it's pretty specific to alreader2 and there's almost none other viewers which save bookmarks in external file in same folder (so I can copy both files anywhere and keep bookmarks working)
Code:
#include <File.au3>
global $drive, $path, $fname, $fext
_PathSplit($cmdline[1],$drive,$path,$fname,$fext)
FileChangeDir($drive & $path)
$cmd = "D:\Office\AlReader\AlReader2.exe """ & $fname & $fext & """"
Run("D:\Office\AlReader\AlReader2.exe """ & $fname & $fext & """");
Not very good solution, but it's better for me than recompiling calibre with patch on each version update. I use by default calibre-viewer - for 'static' epub files, where bookmarks are saved in file, alreader2 is used for epubs 'in progress' where an update of file will erase all bookmarks

Last edited by Andys; 12-11-2015 at 01:42 PM.
Andys is offline   Reply With Quote
Old 12-11-2015, 02:03 PM   #5
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
It's not a calibre patch, it's a patch to the Open With plugin (from before calibre had its own internal Open With feature).
I added it in case anyone was interested in seeing exactly what I changed. The ZIP is the plugin itself.
If it fixes things for you, it could be added to the main version.



If I was going to post a patch for calibre itself, I would have it added upstream so everyone benefits.
eschwartz is offline   Reply With Quote
Advert
Old 12-11-2015, 11:56 PM   #6
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: 45,359
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Just use a launcher script, write it in windows bat or powershell or whatever. Have it process the full pathname however you lke and call whatever program you like.
kovidgoyal is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get full path of the book? esvorontsov Development 1 10-01-2015 04:46 AM
DR1000 DR1000S: How to create file shortcuts using a full path? godel10 iRex 12 03-20-2010 12:12 AM
pdf filename and path on KindleDX ttf Calibre 2 12-19-2009 02:31 PM
Save to Disk now saving file with full path? Mnementh Calibre 3 09-14-2009 01:24 AM
Rebuild Database? & Use Path instead of Filename? gai-jin Calibre 0 07-20-2009 02:58 PM


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


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