Customizing Hookmark Integration with Things

This page provides an example of Hookmark integration scripts: with the Things app from Cultured Code.

-- Get Address for Things
tell application id "com.culturedcode.ThingsMac"
    set n to count of selected to dos
    if n = 1 then
        set todo_id to id of item 1 of selected to dos
    else if n = 0 then
        try
            set todo_name to name of item 1 of windows
            set todo_id to id of to do todo_name
        en try
    else
        set proj to project of item 1 of selected to dos
        repeat with todo in selected to dos
            if proj is not project of todo then
                return
            end if
        end repeat
        set todo_id to id of proj
    end if
    set todo_url to "things://show?id=" & todo_id
    todo_url
end tell

The way Hookmark integrates with Things is somewhat complex. It has different behaviour in different cases:

  • If one item (to do) is selected, Hookmark will link to that item.
  • If a project is open and no items are selected, or if the project header is selected, Hookmark will link with the project.
  • If multiple items are selected, and they all belong to the same project, Hookmark will link to that project.
  • If multiple items are selected, and they do not belong to the same project, Hookmark will not link to anything.

‘Only link to projects’ alternate Things integration

By editing the integration scripts for Things, users can customize Hookmark’s behaviour to match their personal workflows.

For example, a user might prefer to always link to the current list of items (e.g. Inbox, Today, a project). They could do that by using these Get Address and Get Name scripts:

-- Get Name for Things
tell application id "com.culturedcode.ThingsMac"
    get name of item 1 of windows
end tell

Keep in mind that “get name” is now optional. You can leave this field blank and simply return a Markdown link in the Get Address field of this or any app.

-- Get Address for Things
tell application id "com.culturedcode.ThingsMac"
    set todo_id to name of item 1 of windows
    try
        set todo_id to id of to do todo_id
    end try
    get "things://show?id=" & todo_id
end tell