Help with modified Evernote script

One problem with Hook generated Evernote links is that when they are pasted in a document, they look like any other link. It is not obvious that it’s an evernote link.
My idea was to change the Hook Evernote Get Name script so that the link starts with Evernote-
but it does not work. Would you have a suggestion ?
thank you

tell application “Evernote”
if (count of selection) is equal to 1 then
set originalTitle to title of item 1 of (selection as list)
set newTitle to “Evernote-” & originalTitle
set title of item 1 of (selection as list) to newTitle
end if
end tell

Hi @ronny213,

This also addresses the more general request of how to customize the names of links generated by Hook.

Here’s one:

tell application “Evernote”
if (count of selection) is equal to 1 then
"Evernote: " & (get title of item 1 of (selection as list))
end if
end tell

you can apply the same pattern to any script whose title you’d like to modify that way. This means one can customize the names of links generated by Hook for objects of particular apps.

See:

thank you Luc

The new Evernote script above does not work with Hook.

With your new script
evernote:///view/240968/s3/ad1bc334-f870-4ccb-8ac3-f199465c412b/ad1bc334-f870-4ccb-8ac3-f199465c412b/

Pasted link with the old script
Macro to switch toggle default browser between Safari, Chrome and Firefox - Questions & Suggestions - Keyboard Maestro Discourse

Error below when I run it in script debugger

I also don’t understand how to make changes for Scrivener (no get name script)

thank you Luc. Your help is greatly appreciated

Looks like I forgot to mark the text as preformatted, so the quotes around Evernote were pretty (not pretty as far as scripting goes). Try this:

tell application "Evernote"
	if (count of selection) is equal to 1 then
		tell item 1 of (selection as list)
			note link
		end tell
	end if
end tell
1 Like

I think that you are overworked.
You pasted the script for Link, not get name.
Even then, I understood your point and ran the script taking out the quotes and it still does not work

tell application “Evernote”
if (count of selection) is equal to 1 then
Evernote: & (get title of item 1 of (selection as list))
end if
end tell

Oh my universe, that’s fascinating from a cog psy perspective ! Very sorry about that. Here is the Get Name script!

tell application "Evernote"
	if (count of selection) is equal to 1 then
		"Evernote: " & (get title of item 1 of (selection as list))
	end if
end tell
1 Like

works perfectly. Merci Luc !
Absent minded from time to time: it’s the cost of being a genius !

“being genius” : I wish!

But the company’s delighted to participate with the collective intelligence of this community to make it easier for people to access the information they need to do great work :slight_smile: .

1 Like

Luc,

As far as adding prefixes are concerned,

  • you solved Evernote

  • I have the solution for the Scrivener

  • one last request of this type: how would I modify the Bear script to add Bear: prefix

I have no clue where and how I would modify the script, because the note ID is used in the callback

merci beaucoup Luc

Get name script

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///"

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

I am a newbie. Where do I put the EN script solved by Luc? Sounds like a stupid question, so just excuse that part!

Hello,
Certainly not a stupid question. It’s confusing.
Hook → Preferences → Scripts→ Evernote → Get Name
Gook luck !
Based on your name, are you japanese ? I studied japanese 11 years with a private tutor, many years ago.

1 Like

Many thanks. That’s very helpful. I am an Indian and reside in India!