I use AutoKey program for automating certain tasks.
One example is searching for author in Calibre in such a way that it doesn't matter whether I have firstname lastname or lastname, firstname.
Program that is run when I press F2 in my AutoKey is:
Code:
#### Beginning of the Script for F2 hotkey ####
import re
contents = clipboard.get_clipboard()
# re.sub(pattern, repl, string, count=0, flags=0)
output = re.sub(r'([^ ,]*),? (.*)', r'authors:"\1" and authors:"\2"', contents)
keyboard.send_keys(output)
#### End of the Script for F2 hotkey ####
It works in a simple way:
I find somewhere (Calibre itself, or Internet or any text) name of the author, I copy the name such as:
Hugo, Victor
to the clipboard, then I go to Calibre, position cursor to the Search bar and press F2. I get the following
authors:"Hugo" and authors:"Victor"
Well, I *used* to get that. In Beta when I use this script, I get
authors.;hugo; and authors.;victor;
In any other program where I can enter text this works OK.
My system:
I can (and probably will) find a workaround by extending my script from four lines to eight ;-), but this behavior might indicate some problem.
I used to have this tiny hack built into Calibre as modification to the "find similar books" function, and I have even tried to persuade you to put it into main trunk.