Meanwhile AmberV at the Literature and Latte forum helpfully suggests an alternative GUI scripting route:
https://www.literatureandlatte.com/forum/viewtopic.php?p=308444#p308444
I’ll take a look and perhaps update that script tonight, unless anyone feels inclined to beat me to it.