"No linkable item" in Notion — when invoked from Alfred app

Just installed Notion and tried linking to it from Hook ; I get “No linkable item” messages. Oddly, there’s no entry for Notion in the Automation tab under the Hook category (impossible to manually add one either?)

Any hint about what’s causing this? Hook is up to date (3.7.1 4869) and scripts too (230).

Do you mean Notion from Notion Desktop App for Mac & Windows? I just checked it and it seems to be working with Hook. Could you please post a screenshot that shows the problem?

Yes I do.

Screenshots:

image

image

Could you please run the following script in Script Editor and post the result here?

Thank you

Summary
tell application "Notion"
	activate
end tell


tell application "System Events"
	tell process "Notion"
		set the clipboard to ""
		delay 0.5
		
		keystroke "l" using {command down}
		repeat 50 times -- poll clipboard for ~2.5 seconds
			try
				if (the clipboard) is not equal to "" then
					exit repeat
				end if
			end try
			delay 0.05
		end repeat
		set myUrl to the clipboard
		set myUrl to "notion" & text 6 thru (length of myUrl) of myUrl
		
		set AppleScript's text item delimiters to {"/"}
		set myItem to last item of text items of myUrl
		set AppleScript's text item delimiters to {"-"}
		
		if (count of text items of myItem) > 1 then
			set myItems to items 1 thru ((count of text items of myItem) - 1) of text items of myItem
			
			set myTitle to myItems as string
		else
			set myTitle to name of window 1
			
		end if
		return "[" & myTitle & "](" & myUrl & ")"
	end tell
end tell

I’m not exactly proficient in apple scripting but that sure is some cryptic error message…

edit never mind, Notion was hidden when I ran the script. Un-hiding Notion the script now returns the correct link:

"[hello](notion://www.notion.so/hello-ef8a6d0de9dd467abf637106438dc984)"

Well well since Script Editor got the link this got me thinking: it really was the lack of permission that prevented Hook from working.

A bit of googling about missing permissions led me there: Reauthorizing Automation in Mojave | Bitsplitting.org

tldr: I ran tccutil reset AppleEvents, and Hook immediately worked in Notion—problem solved. No idea what caused this. Thanks for your help @bchend.

1 Like

Thank you for letting me know.

Because Notion does not have AppleScript dictionary, I thought Hook does not need Notion’s permission to get url and title using UI scripting.

Okay finally something weird is going on. I swear it was working fine 2 hours ago and now it’s not. I usually call Hook through Alfred (simply typing “hook” in Alfred, and it has worked every time so far) but for some reason it doesn’t work anymore in Notion now. However I have just noticed that clicking on the Hook menu bar icon still works in Notion. I don’t understand why it was working fine through Alfred 2 hours ago and now it’s not, and I don’t understand either why calling Hook through the menu bar would work whereas calling Hook through Alfred wouldn’t.

Any insight?

Sorry for the trouble.

Invoking Hook from Alfred doesn’t seem to work for apps using UI scripting(Notion is one of them). We will have a look.

Sounds like something has changed with Alfred that interferes with Hook. Or perhaps you have turned on the clipboard manager in Alfred? That might cause problems. Hook still works fine with LaunchBar. For invoking Hook in UI-scripted apps (they are singled out graphically on the linkable apps page), I’d recommend using Spotlight as an alternative to Alfred at this point. There’s also Raycast which is free. Same number of keystrokes in either case.

I don’t see any option to turn on a clipboard manager in Alfred?