Copy Markdown Link Shortcut Crashing Hook

When using the Copy Markdown Link keyboard shortcut (the one that doesn’t invoke the Hook window, found on the Shortcuts preference pane) with Drafts, Hook crashes. The shortcut works fine with other applications (e.g. Finder, OmniFocus). Additionally, the Copy Markdown Link Title Menu option doesn’t experience the same issue with Drafts, only the keyboard shortcut.

Perhaps something to do with the new x-callback-url support?

OS version: Big Sur 11.1
Drafts version: 25.1.4
Hook version: 2.2.1 (4004)
Hook scripts version: 156

I can’t replicate that but replacing the Drafts scripts in Hook > Preferences > Script Editor tab with the following would give you the prior integration:

set the clipboard to ""
delay 0.1
tell application "System Events" to tell process "Drafts"
	#get url
	click menu item "Link" of menu 1 of menu item "Copy" of menu 1 of menu bar item "File" of menu bar 1
	repeat 30 times
		try
			set myUrl to (the clipboard)
			if myUrl is not equal to "" then
				exit repeat
			end if
		end try
		delay 0.1
	end repeat
	
	#get title
	set the clipboard to ""
	delay 0.1
	click menu item "Contents" of menu 1 of menu item "Copy" of menu 1 of menu bar item "File" of menu bar 1
	
	repeat 30 times
		try
			set myText to (the clipboard)
			if myText is not equal to "" then
				exit repeat
			end if
		end try
		delay 0.1
	end repeat
	set n to count of paragraphs of myText
	if n is equal to 0 then
		set firstLine to myUrl
	else
		set firstLine to item 1 of paragraphs of myText
		set len to the length of firstLine
		if (len > 256) then
			set firstLine to text 1 thru 255 of firstLine
		end if
	end if
	
	return "[" & firstLine & "](" & myUrl & ")"
end tell

Luc,

Thanks for the quick response. Using the prior integration fixed the problem. Other than the crash log that has already been submitted, is there anything else I can provide to help diagnose?

Thanks , Joel. That’s much appreciated. If you could

  1. Run /Applications/Utilities/Console.app
  2. search for Hook there.
  3. provoke the crash
  4. copy paste the crash report,
  5. send it (compressed) to Support Group that would allow us to analyze the isse.

I suspect the issue that you managed to get the Hook scripts version 156 while running Hook 2.2. But by the time you checked the version, you had already updated to Hook 2.2.1.

The reason I suspect this is that Hook 2.2.1 has an issue such that it cannot see scripts 156. The only way you could see version 156 is with a version before 156. I need to double check, but v 156 is being pulled until this is resolved.