View Single Post
Old 09-11-2022, 09:17 PM   #396
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
Posts: 1,669
Karma: 7908443
Join Date: Sep 2020
Device: none
Quote:
Originally Posted by capink View Post
Use the Action Chains plugin. It has and open with action based on this plugin, but it supports template language which can do what you want.

Make a chain withe single action (Open with action), and configure the action by choosing the path to desired program. After that choose the template option and enter the following template:

Code:
program:
	priority = 'CBZ,CBR,EPUB,MOBI,AZW3';
	paths = formats_paths();
	for fmt in priority:
		path = select(paths, fmt);
		if path 
		then
			path;
			break
		fi
	rof
You can assign this chain to whatever keyboard shortcut you wish. It should open format based on your priority variable.

Notes:
  • Change the order of the formats in the variable highlighted in blue to the order as you wish.
  • The formats should be in UPPER LETTERS.
  • If you don't want the chain to be available for books without these formats, you can set a condition on the chain as follows:
    Code:
    template = copy the same template above
    datatype = text
    comparison = "!="
    condition value = Leave this empty
    Also, check the "disable menu chain if condition is false" check box.
Amazing! That worked!

I have just assigned 'M' as that Chain shortcut key (removed it from 'Merge')...

Then, searched for title:"art of" and (#filter:"=EPUB" or #filter:"=MOBI" or #filter:"=AZW3") , to have the formats I wanted show up for testing...

Then selected one book of each format, pressed 'M'...
and Sumatra opened them instantly !



I think I had installed your Actions Chain Plugin before, but I uninstalled it because I couldn't see any of those dropdown menus... So i thought it had been made strictly for coders (which somehow it is, as I wouldn't be able to generate that program you wrote..)

Now I realise that what was preventing me from figuring out how the PI works was that QT6 interface re-drawing thing, that happened after Calibre 6. Every dialog must be resized by the user, stretched... so one can see all the PI options and enjoy the plugin capabilities.

Last edited by Comfy.n; 09-12-2022 at 08:57 PM.
Comfy.n is offline   Reply With Quote