Bookends 11.3.1 and later have much more robust AppleScript support than earlier versions. You can ask Bookends to return the unique ids of references in any group (including the built-in groups), as well as directly perform SQL searches and get the unique ids of references that match. These capabilities are fully explained in the User Guide in the section Getting reference information from Bookends via AppleEvents.
Below are listed AppleScript examples (without explanation -- see the User Guide for that) that work with the current version of Bookends:
Get unique ids of the selected references or references in a group
tell application "Bookends"
return «event ToySRUID» "Recent papers"
end tell
Get unique ids of references found with an SQL search
tell application "Bookends"
return «event ToySSQLS» "authors REGEX 'Johnson' "
end tell
Ask Bookends to return formatted references
tell application "Bookends"
return «event ToySSQLS» "21864" given «class RRTF»:”true”, string:”APA 6th
Edition”
end tell
Get group names
tell application "Bookends"
return «event ToySRGPN»
end tell
Ask Bookends to return the contents of a specific field
tell application "Bookends"
return «event ToySGUID» "21864" given «class RRTF»:”true”, string:”APA 6th Edition”
end tell
Jon
Sonny Software
Extended AppleScript support in 11.3.1 and later
Re: Extended AppleScript support in 11.3.1 and later
This is great stuff! 
However, I seem to be struggling to understand some basic Applescript concepts. I tried searching reference material and tutorials.
Basically I'm trying to query for all entries (or later all in a particular group), and then query for the entries of that list, using the result from the first query. (Each part works separately.) So, trying to do something like this:
I tried a variety of ways, read about looping and variable assignments etc., but I think there's something really basic I'm not getting ...
(Even two consecutive tell statements don't seem to work, I just get the results from the first ...)

However, I seem to be struggling to understand some basic Applescript concepts. I tried searching reference material and tutorials.
Basically I'm trying to query for all entries (or later all in a particular group), and then query for the entries of that list, using the result from the first query. (Each part works separately.) So, trying to do something like this:
Code: Select all
set listOfEntries to {}
tell application "Bookends"
return «event ToySRUID» "All"
copy result to end of listOfEntries
return «event ToySGUID» listOfEntries given «class RRTF»:"false", string:"RIS"
end tell

flips 

Re: Extended AppleScript support in 11.3.1 and later
I'm only slightly conversant in AS, but what does listOfEntries look like? Is is one long string, or are the id's separated by commas or Return characters (and if Returns, what ASCII, 10 or 13)?
Jon
Sonny Software
Jon
Sonny Software
Re: Extended AppleScript support in 11.3.1 and later
I don't know. I tried adding "print listOfEntries", but no change.
And I can't find standard debugging tools in AppleScript Editor, like running in steps or inspecting variables.
Events list indicates that everything stops after the first return (the triple dots are just me shortening the output):
The same also if I enter just this:
or this:
So, I assume I'm lacking some very basic AppleScript knowledge/understanding. 
And I can't find standard debugging tools in AppleScript Editor, like running in steps or inspecting variables.
Events list indicates that everything stops after the first return (the triple dots are just me shortening the output):
Code: Select all
tell application "Bookends"
«event ToySRUID» "All"
--> "23167
44047
...
36962"
end tell
Result:
"23167
44047
...
36962"
Code: Select all
tell application "Bookends"
return «event ToySRUID» "All"
return «event ToySGUID» "79665,70234,65595" given «class RRTF»:"false", string:"RIS"
end tell
Code: Select all
tell application "Bookends"
return «event ToySRUID» "All"
end tell
tell application "Bookends"
return «event ToySGUID» "79665,70234,65595" given «class RRTF»:"false", string:"RIS"
end tell

flips 

Re: Extended AppleScript support in 11.3.1 and later
The problem is that the 2nd request isn't being run. After the first return you're done. This works for me
set listOfEntries to {}
tell application "Bookends.debug"
get «event ToySRUID» "All"
copy result to end of listOfEntries
return «event ToySGUID» listOfEntries given «class RRTF»:"false", string:"RIS"
end tell
set listOfEntries to {}
tell application "Bookends.debug"
get «event ToySRUID» "All"
copy result to end of listOfEntries
return «event ToySGUID» listOfEntries given «class RRTF»:"false", string:"RIS"
end tell
Re: Extended AppleScript support in 11.3.1 and later
Ah, yes, thanks!
"get" is the command I was looking for.
Had a feeling that return would end the loop, but I didn't know what else to put there.
(Yes, I'm a total n00b when it comes to AppleScript.)

"get" is the command I was looking for.
Had a feeling that return would end the loop, but I didn't know what else to put there.
(Yes, I'm a total n00b when it comes to AppleScript.)
flips 
