Jump to content
zrandall

Hyperlink includes evernotecid when copying from applescript

Recommended Posts

I wrote an apple script that iterates over rows in a spreadsheet, finds the appropriate notebook and note, and auto-files the formatted information from the row at the top of the note to create an organized log. One piece of information I am trying to capture is the web link to an external source (say, the information is a short synopsis of an interesting Wall Street Journal article).

The piece that is currently non-functioning is the hyperlink. It appears as a hyperlink, but includes the evernotecid in the link and so it won't go to the page when clicked. 

Quote

tell application "Evernote"

activate

set evNotebook to "Trends 2.0" as string -- set notebook we'll look in

if subCategory is "" then -- set note we're looking for in that notebook

set evNote to topicCategory

else

set evNote to subCategory

end if

 

set myLink to "</Strong> <br>" & "[Source: " & "<a href=\\" & sourceLink & ">" & sourceName & "</a>" & "] "

 

set theNote to find notes "notebook:\"" & evNotebook & "\" \"" & evNote & "\"" -- find note in notebook

set addNote to "<Strong>" & topicCategory & " > " & subCategory & " > " & tertiaryCategory & " > " & submitter & " - " & inputDate & myLink & sourceSummary & "<br><br>"

set noteHTML to (HTML content of item 1 of theNote)

set addString to "<body>" & addNote

set editHTML to addNote & noteHTML

set (HTML content of item 1 of theNote) to editHTML

 

end tell

The output looks something like the attached; the link is live, but rather than it taking you straight to the right page http://www.bmj.com/content/352/bmj.i1102 it is linked with the evernotecid in front (e.g. evernotecid://[specificnoteblahblah]http://www.bmj.com/content/352/bmj.i1102) 

Any ideas as to why the link is including the evernotecid and how to prevent that so the link goes straight to the source?

[NOTE: if I just enter the link directly, evernote automatically creates it as a hyperlink and is clickable. I'm specifically looking to solve the issue so I don't have to show the full link and instead can simply link readable text]

As reference, Using 6.6 on Mac; Evernote business

Thank you!

 

Screen Shot 2016-04-13 at 4.23.29 PM.png

Share this post


Link to post
On 4/13/2016 at 4:28 PM, zrandall said:

The piece that is currently non-functioning is the hyperlink. It appears as a hyperlink, but includes the evernotecid in the link and so it won't go to the page when clicked. 

You should be able to accomplish your stated objective.  But I can't test your AppleScript because it is incomplete.

I'd suggest this:

  1. Write a very simple script using hard coded data to create a new note with a hyperlink.
  2. When that is working, modify to insert into an existing script.
  3. When that is working, then you can use it as a model, and pull in your data from Excel.

One suggestion:  simplify your Notebook names.  Instead of "Trends 2.0", use "Trends_2", or similar.

Good luck, and let us know how it goes.

  • Like 1

Share this post


Link to post
13 hours ago, JMichaelTX said:

You should be able to accomplish your stated objective.  But I can't test your AppleScript because it is incomplete.

I'd suggest this:

  1. Write a very simple script using hard coded data to create a new note with a hyperlink.
  2. When that is working, modify to insert into an existing script.
  3. When that is working, then you can use it as a model, and pull in your data from Excel.

One suggestion:  simplify your Notebook names.  Instead of "Trends 2.0", use "Trends_2", or similar.

Good luck, and let us know how it goes.

Thanks, JMichaelTX.

It was simply a the \\ that was throwing it off. Peculiar that it caused it to include the evernotecid piece, but nevertheless it's working.

In regards to the naming conventions, I agree -- things I've inherited at work and am cleaning up as time goes on!

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...