This is a pre-announcement regarding the upcoming Hook 2.0 AppleScript.
Following experience with and feedback on Hook’s AppleScript dictionary we are making some improvements to Hook’s AppleScript dictionary. You may recall that we introduced the dictionary in the spring. Our new AppleScript dictionary more directly provides an API to generally access Hook’s data, and allows users to flexibly use various standard AppleScript idioms, syntax and design patterns to interact with it. (I.e., it align with AppleScript conventions.) It introduces some new dictionary terms. The implementation will also be faster.
We know some of you are using tools that depend on Hook’s automation, such as
- Hook’s LaunchBar Action,
- Hook’s Alfred workflow, and
- The Hook CLI created and maintained by Brett Terpstra (@ttscoff).
Rest assured that the first two will be updated by us and released with 2.0. And Brett Terpstra (@ttscoff) will update his Hook CLI - GitHub.
changes to bookmark
the bookmark
object has been changed from a record to a class. It has 4 properties:
-
address
is the item’s URL, and serves as the class’s ID -
name
is exactly what it says on the tin -
posixPath
is a generated property based on the item’s address. If the item is a file which is present and available to user, posixPath is the (unencoded) path of that file -
hooked bookmarks
is a list of the bookmarks which are linked to this bookmarked item.
Since bookmarks are a class, the bookmark from URL
command has been replaced with existing standard AppleScript syntax for creating or getting a class object. Likewise, the all bookmarks
command is redundant and has been eliminated, since bookmarks is an element of the Hook Application object.
Some examples:
- To get a list of every bookmark in Hook:
bookmarks
orevery bookmark
- To get a random bookmark:
some bookmark
- To quickly filter:
every bookmark whose name contains "bread" and address begins with "hook://email"
- To get a bookmark with a given URL:
get bookmark id <URL>
- To create a new bookmark:
make bookmark with data "https://hookproductivity.com/"
ormake bookmark with properties {address:"https://hookproductivity.com/", name:"Hook"}
Note the difference between #4 and #5. bookmark id <URL>
only works if the bookmark already exists in Hook. If there is any uncertainty, it is safer to use #4.
changes to other commands
-
bookmarks hooked to
command has been deprecated, replaced with the hooked bookmarks property -
has hooked bookmarks for URL
has been deprecated, since it is now easy to doexists hooked bookmarks of bookmark id <URL>
-
hook together
andremove hook
have been renamed tohook
andunhook
Other commands unchanged
The other commands are all unchanged, except that they have been updated to return or operate on a bookmark class object, instead of a record.
As explained above, the deprecated commands will remain in place alongside the new syntax until version 2.2.
The dictionary
The dictionary file will be be available from Hook’s AppleScript page. Like this post if you would like us to share a copy sooner rather than later.
Hook 2.0 release date
We are not ready to publish a specific release date for Hook 2.0. However, it’s coming along very well. We’ve put more into it than we had expected. It’s currently tracking for late Sept - early Oct. But no promise of a specific date.
Per Hook’s license terms, updates are free for a year; also available to anyone who has a valid Updates license. Updates licenses last a year.
over to you
We welcome comments and questions as always.