Try this and see if it works:
- Make a batch script that opens whatever program you want.
- Use the open with action to open the batch script, by checking the "open with default app" option. You also need to disable multiple selections. Select the template option and use this template:
Code:
program:
'/path/to/the/batch/script'
- For this to work you need to have at least one book selected, which you can do by using the selection modifier and checking the option to select the first book in the current view.