tell application "DEVONthink Pro"
try
set inspector_path to "~/bin/docears-pdf-inspector.jar"
set this_selection to the selection
if this_selection is {} then error "Please select some contents."
set giveOutput to true
repeat with this_item in this_selection
set filePath to get path of this_item
set prevName to get name of this_item
set oldType to get type of this_item
if oldType = PDF document then
set cmd to "java -jar " & inspector_path & " -title " & quoted form of filePath
set newName to (do shell script cmd)
set name of this_item to newName
if giveOutput = true then log message "Set name for '" & prevName & "' to '" & newName & "'"
else
if giveOutput = true then log message "Skipped setting a new name for '" & prevName & "' because it is not a PDF."
end if
end repeat
on error errtext
display alert errtext
end try
end tell
Might be helpful to some. Pdf Inspector generally does a good job, according to their website its 70%. it works really well on academic papers.
I am probabky doing something wrong as I do not really understand scripts so please forgive me if I have got this entirely wrong I saved this script into my DTPO Scripts>Data folder and then selected some items and run the script. I got the error message as below. Any help to sort out what I have done wrong would be much appreciated. Thanks.
at the bottom of the page there is a section ‘Develop & Download’. it gives you a direct link to the zip archive. download the zip archive (http://docear.org/download/docears-pdf-inspector.zip) to your disk and extract it. you should see a new directory with two files:
docears-pdf-inspector.jar
readme.txt
the jar file is the important file the script needs. put the jar file somewhere where you dont need to move it later again and/or have to delete it. you could probably even copy it into your “DTPO Scripts>Data folder”.
get the path to the jar file, including the filename. in the script you have a line (third line)
set inspector_path to "~/bin/docears-pdf-inspector.jar"
change that to
set inspector_path to "yourpath/docears-pdf-inspector.jar"
if you copy it to the data folder, it should be
set inspector_path to “~/Library/Application Support/DEVONthink Pro 2/Scripts/Data/docears-pdf-inspector.jar”
save it. done.
a bit of caution though: dont just run it on all your files. try it on one and see if you like it