No linkable item in Bear

Hello Luc,

Hook works only intermittently in Bear: sometimes it works and sometimes no linkable item.

I read in a post dated feb what it was fixed in ver 1.31, and I have ver 1.81

If it’s a bug, is there a workaround ?

thank you

image

couple of questions:

  • are you invoking Hook via menu bar icon with Bear , which may lose the focus (UX scripting for Bear), or via keyboard shortcut?
  • version of macOS?

thank you.

1 Like

I should have mentioned Catalina 10.15.6, Bear 1.7.13.
Via the shortcut ⇧⌘Spacebar. I never use the menu bar.
thank you.

1 Like

@ronny213, could you please try replacing the Get Addresss and Get Names scripts of Bear with the following to see if it solves the problem?

Get Address Script

tell application "System Events" to tell process "Bear"
	click menu item "Copy Link to Note" of menu 1 of menu bar item "Note" of menu bar 1
	delay 0.05
	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
	
end tell
get the clipboard

Get Name

tell application "System Events" to tell process "Bear"
	click menu item "Copy Note's Identifier" of menu 1 of menu bar item "Note" of menu bar 1
	delay 0.05
	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
end tell
open location "bear://x-callback-url/open-note?id=" & (the clipboard) & "&x-success=hook://title-callback/title///"

thanks

1 Like

I did all kinds of tests and it works very nicely and appears robust.

Thank you very much Luc.

In case you might be interested:

I was a bit frustrated with all the clicking required to create Hook links and insert them into documents.

I created a keyboard maestro macro which does the following:

  • first I define a central document. It’s very simple: the central document is simply the frontmost (ie selected in the list) document/note in the app. With my macro, what I call the central document can be a Bear Note, an Evernote note or a Scrivener document. It would be very simple to modify my macro to work with any note taking / text editing / word processing app.

  • once the central doc/note is defined, I start working on whatever project I am working on, reading a variety of PDFs, web sites, Evernote and Bear notes, and Scrivener documents.

My macro does the following: when I trigger a global keyboard shortcut a Hook link is automatically to the central document and that link is inserted into the document.

This has make a huge improvement in my workflow.

Based on some posts in this forum, it would appear that some users are frustrated in their attempt to incorporate Hook into their workflow. I am just wondering : would it not be super simple for you to write an appleScript which does the above, and give it to your users ?

A question:
When I paste links into the central doc/note, and the link is a web site or a pdf, it is easy to ascertain, but when the link is a Bear Note, Evernote Note or Scrivener doc, there is nothing that tells me what the underlying app is. To find the underlying app, I must context menu → edit the link which is tedious.
Is it possible to modify the Hook Bear, Evernote, or Scrivener scripts so that for those apps, the link starts with the app name (ie app name prepended to the title of the link), for example if I have a link to a Scrivener doc entitled [First you select ] , I would see
Scrivener[First you select ] instead of just [First you select ]
Could you tell me how to modify the scripts to prepend the app name to the title ?

thanks again Luc

We’re delighted to receive your request. The list of possible workflows built upon Hook (and of so many apps with an API, for that matter) is infinite. We’ve developed and maintain Hook’s API to ensure that automators can create and share macros, workflows, etc. here and on websites where they would be appreciated. As advanced users share automations of Hook (which is an application of their precious time), we will all get a better sense of what the community really wants and how they use Hook. We will likely share more such automations in the future. We agree it is quite helpful to automate the addition of snips to a synoptic notes document.

Currently we are working on Hook 2.0 and significantly updating Hook’s API and extending its user interface.

Here, Help with modified Evernote script - #2 by LucB, we answered your similar request. You’ll see it’s quite easy to customize how titles are generated for notes of particular apps. Internally, we have been discussing providing Preferences to enable users to configure across the board how titles are generated. I have long wanted this, in particular, for emails (to indicate the source or destination and date).

Having said that even with such preferences users will sometimes want to customize the names of particular links they have pasted in documents. E.g., even when sending the same Hook-generated link to two different people the name may need to differ.

thank you. It does not add a prefix. Links look like before

example

Table of Contents

I’m running into this error now. Is this something that I need to manually address in Hook or should it be fixed by default? It has been working but now, suddenly, I can’t Hook anything to Bear.

MacOS 11.6
Hook 3.2.1
Bear 1.8.5

not sure this is relevant to previous discussion as a lot of things have changed since last post, but thought this is the most appropriate thread to post this.

I used Hook to copy the Bear Notes article link, then paste that into my Logseq block, it showed the following

Screen Shot 2022-05-31 at 9.23.47 am

but when I clicked the link from Logseq, it opened the correct notes in Bear, any issue despite the error message?

I don’t use Logseq, but I imagine that it is a generic message due to pasting an app link. Presumably Logseq has no way to preview the content of items from other apps. You could try constructing a markdown link manually from a link to any other local app that you use, or even from Bear itself, without getting the link from Hook, and I imagine you would get the same results.