Hi,
been looking around and did not immediately see a previous question regarding filing files to Evernote using Keyboard Maestro.
I have taken a look at the Third Party Action extension, but it does not fit the purpose.
So, what do I want to do: select a file (or multiple files) in Finder, and add these to Evernote. Each file as a separate note, and the file name without extension as note title.
In the Keyboard Maestro macro itself I would like to add some tags as well.
PS: I have an Applescript which I use in Hazel and Automator to do this, but I struggle with the Keyboard Maestro migration…
tell application "Evernote"
activate
create note from file theFile notebook {"myNotenook"} tags {"myTag1", "myTag2", "myTag3"}
end tell
PPS: the advantage of doing this via Keyboard Maestro is that it syncs the behavior to all my machines, which is magic!
Don’t be scared by the error-handler which is bigger than the script. Â
-Chris
------------------------------------------------------------
# Add files selected in the Finder to Evernote.
------------------------------------------------------------
try
tell application "Finder" to set finderSelectionList to selection as alias list
if finderSelectionList ≠{} then
tell application "Evernote"
activate
repeat with theFile in finderSelectionList
create note from file theFile notebook {"myNotenook"} tags {"myTag1", "myTag2", "myTag3"}
end repeat
end tell
end if
on error e number n
set e to e & return & return & "Num: " & n
if n ≠-128 then
try
tell application (path to frontmost application as text) to set ddButton to button returned of ¬
(display dialog e with title "ERROR!" buttons {"Copy Error Message", "Cancel", "OK"} ¬
default button "OK" giving up after 30)
if ddButton = "Copy Error Message" then set the clipboard to e
end try
end if
end try
------------------------------------------------------------
In addition: let’s say that I want to use this one script, but based on the Keyboard Maestro if statements, want to make the Notebook and Tag “string” variables.
Is this easily done?
Hi guys,
I wanted to add something to the script.
After adding the file(s) to Evernote, they can be trashed.
So I added this lines right after the Evernote “create note” statement.
set posixFile to POSIX file theFile
tell application "Finder"
move posixFile to trash
end tell
However, I get following error.
Evernote got an error: Can’t get POSIX file (alias "Macintosh HD:Users:xxx:Dropbox (Personal):Action:xxx-receipt_2016-05-26_16-06-4 copy.pdf").
Num: -1728
You’re trying to mess with posix-files in the Finder. It doesn’t like them especially.
On top of that you’re trying to tell an alias to a file that it’s a posix-file - that doesn’t work too well.
In my script theFile is already an alias – a file-object-specifier the Finder understands.
Moving an item to the trash using its alias is simple:
tell application "Finder"
set finderSelectionList to selection as alias list
if length of finderSelectionList = 0 then error "No files were selected in the Finder!"
set theItem to item 1 of finderSelectionList
delete theItem
end tell
* Note – an alias in AppleScript is similar to but different from an alias file in the Finder.
Was looking for a macro that would move files in finder to Evernote. Looks like this is it. However, there are several edits along the way and I was wondering if someone could post a complete .kmmacros file that has passed the test of time.