(*
add – new item into Evernote
Process the file in NoiseNinja beforehand
NoiseNinja should have a setting "Start in a SideKick mode"
*)
on adding folder items to this_folder after receiving added_items
set Make_ to "Plustek"
set Model to "OpticSlim M12 Plus"
set ISO to "200"
set NoiseNinja_filepath to POSIX path of "Applications:NoiseNinja.app"
tell application "System Events" to set NoiseNinja_count to count (every process whose name is "NoiseNinja")
if NoiseNinja_count is equal to 0 then
tell application "NoiseNinja" to activate
tell application "System Events"
set visible of process "NoiseNinja" to false
end tell
delay 1
end if
delay 2
repeat with item_ in added_items
set image_filepath to POSIX path of item_
-- Set EXIF parameters for NoiseNinja to catch profiled image properly
set exiftool_successful to false
try
set command to "exiftool -overwrite_original -Make='" & (Make_) & "' -Model='" & Model & "' -ISO=" & ISO & " " & quoted form of image_filepath
do shell script command
set exiftool_successful to true
end try
-- display dialog "Hello!"
set NoiseNinja_successful to false
set initial_size to size of (info for item_)
-- display dialog "The file is " & (initial_size as integer) & " bytes"
try
set command to "open -a " & quoted form of NoiseNinja_filepath & " " & quoted form of image_filepath
do shell script command
set NoiseNinja_successful to true
end try
-- Now wait till NoiseNinja saves the file
if (exiftool_successful = true) and (NoiseNinja_successful = true) then
set new_size to size of (info for item_)
repeat until new_size is not equal to initial_size
delay 0.5
set new_size to size of (info for item_)
end repeat
delay 1
end if
tell application "Evernote"
create note from file item_ notebook "Scanned"
end tell
end repeat
end adding folder items to