Thanks, Jon!
Here is what would be great to have, in the style of the Bookends user guide. I have changed the API from what I wrote earlier, to make it more parsimonious. I don't know much about Apple Events, so there might be things that have to be done differently.
The first two API methods would suffice to achieve what I need (read-only access to the group information):
Get the ids of the group a reference is associated with
Event id: GGID
Parameters: Reference Id
Classes: none
Example:
Code: Select all
tell application "Bookends"
return «event ToySGGID» "1234"
end tell
In this case, Bookends will return the ids of all groups the Reference with the given ID is in, in a Return (ASCII 13)-delimited string.
Get the name of a group with the given ID
Event id: GGNM
Parameters: Group Id
Classes: none
Example:
Code: Select all
tell application "Bookends"
return «event ToySGGNM» "1234"
end tell
In this case, Bookends will return the name of the group with the given ID in.
Get the ids of the parent groups of a group with the given Id
Event id: GGPT
Parameters: Group Id
Classes: none
Example:
Code: Select all
tell application "Bookends"
return «event ToySGGPT» "345"
end tell
In this case, Bookends will return the ids groups that are parents of the group with the given ID. For example, if you have the following tree structure:
Code: Select all
Animals (ID: 21)
|--Mammals (ID: 205)
| |--Cats (ID:345)
|
And you would query the path for "Cats" with the Id of 345, the result would be
in a Return (ASCII 13)-delimited string. If the given group is on the top (root) level, an empty string is returned.
*****
The following methods would be great to have, as they would allow write access also:
Change the name of the group with the given Id
Event id: GPNM
Parameters (required): String consisting of the unique id of the group you want to modify and the new name, separated by comma.
Classes: none
Example:
Code: Select all
tell application "Bookends"
«event ToySGPNM» "345,Felinae"
end tell
If an error occurs, an error message is returned.
Change the parent of the group with the given Id
Event id: GPPT
Parameters (required): String consisting of the unique id of the group you want to modify and the id of the new parent, separated by comma.
Classes: none
Example:
Code: Select all
tell application "Bookends"
«event ToySGPPT» "345,21"
end tell
If an error occurs, an error message is returned.
Create a new group
Event id: GPCR
Parameters (required): String consisting of the new group
Classes: none
Example:
Code: Select all
tell application "Bookends"
«event ToySGPCR» "Golden Retriever"
end tell
In this case, Bookends returns the ID of the new group. The group is created at the root level and can then be moved under a new parent with GPPT.
Delete a group
Event id: GPDL
Parameters (required): The unique Id of the group
Classes: none
Example:
Code: Select all
tell application "Bookends"
«event ToySGPDL» "345"
end tell
If an error occurs, Bookends returns an error message.
***
It would be great if you could implement some or even all of these Events. Thanks a bunch for considering this feature request.