View Single Post
Old 09-11-2022, 07:55 PM   #393
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,198
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
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.

Last edited by capink; 09-11-2022 at 08:06 PM.
capink is offline   Reply With Quote