Page 1 of 1

Guide to Applescript and Bookends

Posted: Mon Feb 25, 2019 10:37 am
by Jon
In case you missed it, our web site now has a very helpful scripting guide for Bookends, written by Matthias Steffens.

https://www.sonnysoftware.com/scriptingbookends/

Jon
Sonny Software

Re: Guide to Applescript and Bookends

Posted: Mon Feb 25, 2019 11:46 am
by msteffens
Jon wrote: Mon Feb 25, 2019 10:37 am our web site now has a very helpful scripting guide for Bookends
Thanks, Jon!

To everyone: If anyone has any questions or suggestions w.r.t. the topics or examples in the scripting guide, please let me know.

Matthias

Re: Guide to Applescript and Bookends

Posted: Sat Apr 27, 2019 2:44 pm
by jwillj
I'm having trouble with getting AppleScript with the "selected publication items" group to work properly. It seems that the selected publication items group does not correspond to the actual items I have selected in the library window. So I tried an experiment to see what items the selected publication items point to. I mark two items in my library for the hits list, and then select them in the library window (displaying the hits list), here's what happens when I run my AppleScript:

Code: Select all

tell application "Bookends"
	
	tell front library window
		publication items of group hits --> {publication item id "776" of group item id "Hits" of library window id 1, publication item id "10012" of group item id "Hits" of library window id 1}
		selected publication items --> {publication item id "14349" of library window id 1, publication item id "66300" of library window id 1}
		
	end tell
end tell
By my logic, the items in the hits list should match those in the selected publication items, but the latter seems to compose arbitrary items from the library.

Thanks,
-Will

Re: Guide to Applescript and Bookends

Posted: Sat Apr 27, 2019 4:10 pm
by zvh
Yes, I've found this as well. Rebuilding my library seems to temporarily fix the problem, but it returns soon after. It always seems to be references added in close proximity that the "selected publication items" command confuses--i.e. selecting the most recent reference will return data for the 5th most recent reference.

Re: Guide to Applescript and Bookends

Posted: Sat Apr 27, 2019 4:34 pm
by Jon
Maybe I'm mistaken, but are you implying that marked references (i.e. hits) are the selected references? If so, that's not correct. The selected references refers to those that are visibly selected in the UI. It has nothing to do with the marked (hit) status.

Jon
Sonny Software

Re: Guide to Applescript and Bookends

Posted: Sat Apr 27, 2019 5:36 pm
by zvh
Perhaps I misread Will's post as speaking to my own situation, but I'm referring to the visibly selected references in the UI and not to marked references. In my case, it's only a problem with references that are recently added, and then when I rebuild the library it seems to clear up the problem with those references. Subsequent references then require another rebuild to be properly indexed by the "selected publication items" command. If not, they return another recently added reference when selecting a reference in the UI. I had thought that perhaps this was something faulty with my library, so had put off reporting. This could still be the case, of course.

Re: Guide to Applescript and Bookends

Posted: Sat Apr 27, 2019 6:05 pm
by Jon
If Rebuilding fixes an issue then it could indeed be with the library. If you can reproduce this with a fresh new database please tell me what steps I need to take to see it.

Jon
Sonny Software

Re: Guide to Applescript and Bookends

Posted: Sat Apr 27, 2019 8:41 pm
by jwillj
Hi Jon,
Sorry I if my original post wasn't clear. I am indeed talking about publication items visibly selected in the UI. When I was trying to script using selected publication items, I found it was not responding as I expected. So I wrote the script to test its behavior. That's when I discovered the "selected publication items" did not correspond to those selected in the UI. I'll try reproducing with a fresh library and see if it behaves the same way.

Re: Guide to Applescript and Bookends

Posted: Sat Apr 27, 2019 8:53 pm
by jwillj
I rebuilt my library, and now the selected publication items behaves as expected. Thanks for the recommendation.