Devonthink Script Error

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Devonthink Script Error Fri Dec 31, 2021 8:57 am • by snpower
Hi,

I have created a basic rule to rename a file, then execute the Devothink Pro script, "Import, OCR, and delete".

This results in a file rename, and an error as seen in the Hazel log entry below:

2021-12-31 07:42:54.180 hazelworker[75290] [Error] AppleScript failed: Error executing AppleScript on file /Users/stephenpower/Documents/PDF Processing/OCR/2021-12-31 2021-12-31 2021-12-31 2021-12-31 1.pdf.
2021-12-31 07:42:54.180 hazelworker[75290] OSAScript error: {
OSAScriptErrorNumberKey = "-1708";
}
It is also renaming the file multiple times ??

https://imgur.com/a/0JzjhW0
snpower
 
Posts: 10
Joined: Fri Jul 02, 2010 3:03 pm

Re: Devonthink Script Error Fri Dec 31, 2021 10:10 am • by Mr_Noodle
Can you post the script?
Mr_Noodle
Site Admin
 
Posts: 11867
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Devonthink Script Error Fri Dec 31, 2021 1:38 pm • by snpower
Mr_Noodle wrote:Can you post the script?


Code: Select all
-- DEVONthink - Import, OCR & Delete.applescript
-- Created by Christian Grunenberg on Fri Jun 18 2010.
-- Copyright (c) 2010-2017. All rights reserved.

on adding folder items to this_folder after receiving added_items
   try
      if (count of added_items) is greater than 0 then
         tell application id "DNtp" to launch
         repeat with theItem in added_items
            set thePath to theItem as text
            if thePath does not end with ".download:" and thePath does not end with ".crdownload:" then
               set lastFileSize to 0
               set currentFileSize to 1
               repeat while lastFileSize ≠ currentFileSize
                  delay 0.5
                  set lastFileSize to currentFileSize
                  set currentFileSize to size of (info for theItem)
               end repeat
               
               try
                  tell application id "DNtp"
                     set theRecord to ocr file thePath to incoming group
                     if exists theRecord then tell application "Finder" to delete theItem
                  end tell
               end try
            end if
         end repeat
      end if
   end try
end adding folder items to
snpower
 
Posts: 10
Joined: Fri Jul 02, 2010 3:03 pm

Re: Devonthink Script Error Mon Jan 03, 2022 10:06 am • by Mr_Noodle
Check the manual on AppleScript. You need to use a specific handler with Hazel.
Mr_Noodle
Site Admin
 
Posts: 11867
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support