Scripted PDF import from file

Hey guys,

I have the need to import a PDF file into Devonthink Pro Office with a shell script:


#!/bin/bash
osascript  <<END!  - "$@"
on run {title, pathToPDF}
    tell application id "DNtp"
        try
            set pdfFile to pathToPDF as POSIX file
            create record with {name:title, type:PDF, path:pdfFile} in current group
        on error error_message number error_number
            if the error_number is not -128 then display alert "DEVONthink Pro" message error_message as warning
        end try
    end tell
end run
END!

Everytime I invoke it , I get an error message “missing value” !

./importPDF.sh "Title" OS\ X\ Tutorial:\ Menus\ and\ Popovers\ in\ Menu\ Bar\ Apps.pdf

This is driving me mad.
Any help will be greatly appreciated.

Cheers
Thorsten

Just use the import command instead of the create command:


import pdfFile name title to current group

Christian,

that did it! You saved my day! Thank you so much

Cheers
Thorsten