I thought that creating an EN Note from HTML using AppleScript would NOT pull in the images referenced by the HTML.
But upon testing I just completed, I have found it does.
I'll post a more complete script later, but for those that are interested, here is my test script:
###Test AppleScript
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
--- GET THE HTML FILE YOU WANT TO READ ---
set pathInputFile to (choose file with prompt "Select the HTML file")
--- READ THE FILE CONTENTS ---
set htmlStr to read pathInputFile
set noteTitle to "TEST Import HTML by Script"
set nbName to ".InWork"
tell application "Evernote"
create note with html htmlStr title noteTitle notebook nbName
end tell
You've found a solution, but let me answer your original question.
To simulate opening files by dragging and dropping to an app-icon in the Finder:
tell application "Finder"
set finderSelectionList to selection as alias list
if length of finderSelectionList = 0 then error "No files were selected in the Finder!"
open finderSelectionList using application file id "com.apple.TextEdit"
end tell
And for that matter the open verb is universal in AppleScript, so something like this should generally work even if an app is NOT scriptable:
tell application "Finder"
set finderSelectionList to selection as alias list
if length of finderSelectionList = 0 then error "No files were selected in the Finder!"
end tell
tell application "Editra"
if not running then
launch
delay 0.5
end if
activate
open finderSelectionList
end tell
KM has the Open The Finder Selection action which should allow any selected file to be opened by any specified application. Thus, one macro could be used to open any Finder selection with (in this case) Evernote.
KM continues to amaze me. I've used that KM Action many, many times. Yet it never occurred to me to use it in this case, not even after @ccstone's script.