@capink: A question ...
I sometimes want to run a (python) template over the selected books. This isn't the easiest thing to do.
Solutions I have found:
- Select the books then use the template tester. Although this works, it isn't an obvious or particularly efficient solution. For example it doesn't support keyboard shortcuts. It does have the advantage that I can see error output.
- Write a Python code action. This works, but I must implement in the template iteration over the currently selected books. In addition, there isn't a good way to show errors.
- Write a Formulas action. Here I again must implement my own selection iteration. However, it has the advantage that I can display errors. However, I can't find a way to show nothing if there is no output.
- Use a Single Field Edit. This solution takes care of iteration. However, it really wants to modify some column, which in this case I don't want to do. The work-around: pick a column like Title and return that value so nothing changes. In addition, it isn't easy to see errors without using an "error column" (long comments) and writing the errors into that.
To solve this problem I have considered making a calibre action that runs a template over the selected books. If the template produces no output then the action doesn't show a dialog. If the template does produce output for any/all books then it opens a dialog like the middle part of the template tester, showing the output per book.
My problem with this solution is that it feels like I am reinventing a part of Action Chains, which seems a bit silly to me. A Formulas-like action that iterates over the selection and shows output only if there is any is more-or-less the same thing.
What are your thoughts? How would you solve this problem?