Hello, I have many Evernote notes which contain a single attached file (OutlineEdit files). Is there any way to create a macro which would open the attached file located in the current note I am working in. The equivalent of right-click - Open on file icon. thanks very much
This was tough, because I wanted to use AppleScript to select the attachment icon in Evernote. But the Evernote UI just doesn't allow it (at least I couldn't figure it out).
So, I had to fall back on "Found Image" Action. It uses this image, but you may want to create your own image and paste into the KM Action "Find FIRST Image...":
(without the border)
This was taken from the Evernote attachment icon:
##Macro Library [EN] Open Note Attachment [Example]
####DOWNLOAD:
<a class="attachment" href="/uploads/default/original/2X/e/ee5cda4fd38a5e08a3551791ac35c804ef9db928.kmmacros">[EN] Open Note Attachment [Example].kmmacros</a> (20 KB)
---
###ReleaseNotes
* I choose to use the "Open With" menu item to make it more flexible, to allow you to choose either the Default App (selected by default), or just arrow down and choose another app.
* You can obviously change this to "Open" and the "Type a Keystroke" to "RETURN" if you always want to use the Default App
.
* There is also a 1 sec pause AFTER the image is found, to allow you to see if other attachments are also found. It will select the FIRST attachment in the Note.
* You can reduce this to 0.2 sec if you don't care about other attachments.
---
###MACRO: [EN] Open Note Attachment [Example]
~~~ VER: 1.0 2016-10-24 ~~~
####DOWNLOAD:
<a class="attachment" href="/uploads/default/original/2X/6/6bc8840f186585faf9c1f8415125f9b9bf66bc5f.kmmacros">[EN] Open Note Attachment [Example].kmmacros</a> (20 KB)
---
<img src="/uploads/default/original/2X/7/7c3bb31d4dfb5faee9e3c9a0c298dd585b779364.png" width="626" height="886">
Hello,
Thank you for a very imaginative solution.
The macro fails. Below is part of the notification. Have not figured out how to see complete text of notification.
Hi, this is the icon which is consistently there in attached files, without the @
thanks again
The full message is in the Engine.log file.
The error is telling you that the calculation ENA_FirstFoundImage.Midx failed, probably because ENA_FirstFoundImage is empty after the Find Image action did not find anything (you can check the value of the variable in the Keyboard Maestro Variables preference, or add a debugging action to display its value.
thank you Peter.
what is my next step ?
No idea, I don’t have Evernote or know how to control it, I was just explaining what the error is and what it means. How to fix the macro means fixing that issue, but I don’t know how to do that.
FYI, I'm just skimming this topic, so I haven't read much.
@JMichaelTX is one of the people who use Evernote and KM, so perhaps he can be of further help. I know he replied to this topic once... If it turns out you don't understand what he's posted, please let him know, because he's very good at helping, but all of us at one point or another end up confusing people more than helping, and if you don't tell us, we won't know!
You have a good point. Thank you Dan.
Yes you are right and sorry for the absurd question.
I can’t find engine.log
tried help and tried file search app.
thanks Peter
OK, I found it. thanks
Hi, the macro failed so I tried to trim it down to the bare minimum.
I am wondering that the next step is.
There is the error message from the error log and below a picture of the macro and a picture of the image to search for
please note that I disabled pause to see if multiple attachments
thanks again very much
2016-10-27 15:05:27 Execute macro ‘[EN] Open Note Attachment version 1’ from trigger The Hot Key ⌃F4 is pressed
2016-10-27 15:05:27 Move or Click Mouse calculation TEST__FirstFoundImage[1] failed.
2016-10-27 15:05:27 Move or Click Mouse calculation TEST__FirstFoundImage[1] failed. Macro ‘[EN] Open Note Attachment version 1’ cancelled (while executing MOVE Mouse to FIRST Attachment, and RIGHT-Click).
I have just posted a macro tool to display the full error message of the LAST macro error that was logged:
The macro I posted above is just the most basic macro, designed to show you the basic method to achieve your objective. As always, you will most likely need to further adjust to meet your specific needs.
As I said above:
I have now posted a more full-featured macro, which does some error checking/handling, but you will still probably need to do a screen capture of the Evernote Attachment icons and paste into the Macro Action:
###Here's the Complete Macro
Thank you so much for all the work, and finding a solution which works.
I tested it and it works fine if, at the time the macro is activated, the note is highlighted in the note list. It does not work if the cursor is located inside the note - simply types Open With in the note wherever the cursor is located.
thanks again very very much
correction: the macro works is the note is completely open, or if the cursor is on the note list, but not if the note itself. It will not run if the cursor is inside the note with the note list visible.
Its perfect as is. thanks again.
I do not understand what you mean.
When I place the cursor inside of the Note body, and trigger the Macro, then it works as expected. You should see something like this:
If the right-click is not occurring ON the Attachment icon, then maybe the image you are using is not correct.
OK, then. I guess all's well that ends well.
In Keyboard Maestro, Help ➤ Open Logs Folder
I am very grateful for your extensive help
Hey Folks,
I don’t find any method of doing what Ronald wants other than what JM posted.
I’ve looked at AppleScript and GUI-Scripting without success.
The closest I can get is to actually export the attachment.
--------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2016/10/25 07:37
# dMod: 2016/10/30 15:19
# Appl: Evernote
# Task: Copy attachments from selected note to the Finder.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @Evernote, @Copy, @Attachments, @Note
--------------------------------------------------------------------------------
tell application "Evernote"
set theNote to item 1 of (get selection)
repeat with theAttachment in (attachments of theNote)
write theAttachment to (path to desktop folder as string) & (filename of theAttachment)
end repeat
end tell
--------------------------------------------------------------------------------
NOTE: This does not allow edits to be picked up by Evernote.
This script only copies one or more attachments from the selected note to the Finder. To do more will require more scripting.
-Chris
Yep, that was the same conclusion I came to.