Guest

NoiseNinja + Evernote denoising script

By: a guest on Apr 18th, 2010  |  syntax: AppleScript  |  size: 1.94 KB  |  hits: 203  |  expires: Never
download  |  raw  |  embed  |  report abuse
This paste has a previous version, view the difference. Copied
  1. (*
  2. add – new item into Evernote
  3.  
  4. Process the file in NoiseNinja beforehand
  5. NoiseNinja should have a setting "Start in a SideKick mode"
  6.  
  7. *)
  8.  
  9. on adding folder items to this_folder after receiving added_items
  10.         set Make_ to "Plustek"
  11.         set Model to "OpticSlim M12 Plus"
  12.         set ISO to "200"
  13.         set NoiseNinja_filepath to POSIX path of "Applications:NoiseNinja.app"
  14.        
  15.         tell application "System Events" to set NoiseNinja_count to count (every process whose name is "NoiseNinja")
  16.        
  17.         if NoiseNinja_count is equal to 0 then
  18.                 tell application "NoiseNinja" to activate
  19.                 tell application "System Events"
  20.                         set visible of process "NoiseNinja" to false
  21.                 end tell
  22.                 delay 1
  23.         end if
  24.        
  25.        
  26.         delay 2
  27.        
  28.         repeat with item_ in added_items
  29.                 set image_filepath to POSIX path of item_
  30.                
  31.                 -- Set EXIF parameters for NoiseNinja to catch profiled image properly
  32.                 set exiftool_successful to false
  33.                 try
  34.                         set command to "exiftool -overwrite_original -Make='" & (Make_) & "' -Model='" & Model & "' -ISO=" & ISO & " " & quoted form of image_filepath
  35.                         do shell script command
  36.                         set exiftool_successful to true
  37.                 end try
  38.                
  39.                 -- display dialog "Hello!"
  40.                 set NoiseNinja_successful to false
  41.                 set initial_size to size of (info for item_)
  42.                 -- display dialog "The file is " & (initial_size as integer) & " bytes"
  43.                 try
  44.                         set command to "open -a " & quoted form of NoiseNinja_filepath & " " & quoted form of image_filepath
  45.                         do shell script command
  46.                         set NoiseNinja_successful to true
  47.                 end try
  48.                
  49.                 -- Now wait till NoiseNinja saves the file
  50.                 if (exiftool_successful = true) and (NoiseNinja_successful = true) then
  51.                         set new_size to size of (info for item_)
  52.                         repeat until new_size is not equal to initial_size
  53.                                 delay 0.5
  54.                                 set new_size to size of (info for item_)
  55.                         end repeat
  56.                         delay 1
  57.                 end if
  58.                
  59.                 tell application "Evernote"
  60.                         create note from file item_ notebook "Scanned"
  61.                        
  62.                 end tell
  63.         end repeat
  64.        
  65. end adding folder items to