Question about Hook to New with Things 3

Hey all. I really see the potential with Hook and I’m very impressed so far! One thing I can’t figure out though is a deeper Hook to New Things task. Currently if I Hook to a new task, the title of the hooked link shows up as a new task but there is no actual hooked link. Hopefully this is already a feature and I’m just missing it! If not though, here’s the details.

For example, Craft introduced their Connect feature where you can select a block and add it as a task to Things, but when you open the Things task a callback URL to the specific block is in the notes section of the task. Is there a way to emulate this with Hook?

My use case is this - I want to add an email from Spark to my Things list with a link to the email in the notes of the task for ease of opening. However, only the subject line of the email is represented in the task, no link to the actual email. This results in having to go back to the email and copy the link in Hook then going back to the task created by Hook and pasting it. Quite a bit of friction.

I’d say the idea for Hook is to invoke the Hook bar with the Things item selected (Shift+Command+Space), and that way you get immediate access to all the hook links attached to that item. If I wasn’t going to use Hook that way I would just use the Quick Add in Things with Things helper (set to Ctrl+Option+Command by default I believe).

However, I also like to use Things on my iPad and iPhone, and Hook isn’t there yet, so I edited the script a little (cannibalising bits of the OmniFocus Hook to New Script). So my script does exactly what I think you’re asking for. If you open the Hook Preferences Window, go to scripts, and select Things, you can replace what you currently have under “New Item” with this:

tell application id "com.culturedcode.ThingsMac"
    set new_todo to make new to do
	set AppleScript's text item delimiters to {"$$$"}
    set srcURL to text item 1 of "$link"
    set name of new_todo to "$title"
	set notes of new_todo to srcURL
    set todo_url to "things:///show?id=" & id of new_todo
    edit new_todo
    activate
end tell
todo_url

The links to Finder items and a few other things won’t work in iOS unfortunately (basically, if it doesn’t have a URL scheme it will produce a Hook link instead).

1 Like

This is exactly what I was looking for! It is unfortunate that hooked items won’t show up on iOS, but I do most of my heavy lifting stuff on my MacBook anyway so this works perfectly.

I found too that with Spark, you can link Things to Spark to enable easy adding with a url to the Spark message, but I’ll definitely be using this for everything else. It has already come in handy for Outlook messages that I need to get to at a later date. Thank you so much for this!

1 Like

No worries, my script stands on the shoulders of scripts that came before it :slight_smile: I also found someone else here had made more or less the exact same thing before I did.

1 Like

I’ve run into an issue that I can’t figure out (mostly because I don’t know AppleScript). It works just like it needs to, but it looks like it encodes the & sign in the link to %26 which then breaks the link. I’ve tried a lot of different things in the script to find and replace, but at the end of the day I don’t know exactly what I need to look for to fix it. I’m also not sure if this is a Hook, Things, or AppleScript issue.

Okay, I figured it out. I changed $link to $user_link per a different thread.

2 Likes

Great stuff! I’ll do the same!

Sorry for the delay in attending to this, all. Our Things integration specialist has been unavailable recently. I’ve asked another dev here to look into it. In general, CogSci Apps wants Hook to insert linkbacks where it backs sense (ultimately as an option). We also share some scripts to add a “Hook” tag.

All good. Just to reiterate, the script above from @Jan_Salomonsson works perfectly, but within the script the $link needs to be changed to $user_link to keep the & symbol from being encoded.

I also haven’t used this particular script with very many resources, but I will try it. I have used it for Craft though, and that is where the issue came to my attention but it is now resolved with the $user_link change.

$user_link is meant to be a user ready useable link, so it isn’t percent encoded (beyond the basic percent encoding that all URLs have), and it doesn’t have the extraneous suffix which lines 3 and 4 of @Jan_Salomonsson 's script slice off.

Here’s a minor adjustment to that script, it should do the exact same thing but uses $user_link and removes those lines.

tell application id "com.culturedcode.ThingsMac"
	set new_todo to make new to do
	set notes of new_todo to "$user_link"
	set todo_url to "things:///show?id=" & id of new_todo
	edit new_todo
	activate
end tell
todo_url
1 Like

@grahamb I tried this but it doesn’t label the task with the title of the page, which I prefer.

Thank you @tward09 for bringing this up, and Welcome to the Hook Productivity Forum .

Version 161 of Hook software integration is now available: Updates to CulturedCode Things Mac app and Mac PDF apps - Releases - Hook Productivity Forum. Provides full backlinks in notes of tasks created via Hook to New > Things .

You can use this then, it adds the title bit to Graham’s script:

tell application id "com.culturedcode.ThingsMac"
set new_todo to make new to do
set name of new_todo to "$title"
set notes of new_todo to "$user_link"
set todo_url to "things:///show?id=" & id of new_todo
edit new_todo
activate

end tell
todo_url

thanks, Jan. The Things script we published in Hook based on above was supposed to have the title too. Does the title not show up?

I reverted to your default and it works fine now - when you have a custom script of course an update won’t overwrite it :wink: so I had no idea what you had done.

1 Like

Thanks, Jan. On the road map, we’ll add some additional indicators and options for the integration scripts.