Guide to Applescript and Bookends

Users asking other users for AppleScripts that work with Bookends.
Post Reply
Jon
Site Admin
Posts: 10202
Joined: Tue Jul 13, 2004 6:27 pm
Location: Bethesda, MD
Contact:

Guide to Applescript and Bookends

Post 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
msteffens
Posts: 39
Joined: Thu Jul 19, 2007 10:04 am
Location: Germany
Contact:

Re: Guide to Applescript and Bookends

Post 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
jwillj
Posts: 4
Joined: Sat Dec 01, 2018 7:57 pm

Re: Guide to Applescript and Bookends

Post 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
zvh
Posts: 32
Joined: Sun Aug 27, 2017 12:47 am

Re: Guide to Applescript and Bookends

Post 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.
Jon
Site Admin
Posts: 10202
Joined: Tue Jul 13, 2004 6:27 pm
Location: Bethesda, MD
Contact:

Re: Guide to Applescript and Bookends

Post 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
zvh
Posts: 32
Joined: Sun Aug 27, 2017 12:47 am

Re: Guide to Applescript and Bookends

Post 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.
Jon
Site Admin
Posts: 10202
Joined: Tue Jul 13, 2004 6:27 pm
Location: Bethesda, MD
Contact:

Re: Guide to Applescript and Bookends

Post 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
jwillj
Posts: 4
Joined: Sat Dec 01, 2018 7:57 pm

Re: Guide to Applescript and Bookends

Post 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.
jwillj
Posts: 4
Joined: Sat Dec 01, 2018 7:57 pm

Re: Guide to Applescript and Bookends

Post by jwillj »

I rebuilt my library, and now the selected publication items behaves as expected. Thanks for the recommendation.
Post Reply