PDF imported as kind: Document?

The PDF is downloaded from online banking into my Downloads folder.

Hazel renames and imports the PDF to DevonThink with the following apple script:

tell application id "DNtp"
	set theDatabase to open database "/Users/username/Databases/Paperless.dtBase2"
	set theYear to do shell script "awk -F: '{print $NF}'<<<" & theFile & "| awk -F- '{print $1}'"
	set theLocation to "/Banking/Credit card/" & theYear
	set myGroup to create location theLocation
	set myRecord to import (POSIX path of theFile) to myGroup
	set label of myRecord to 1
	set tags of myRecord to {"Banking", "Credt card"}
end tell

The PDF is imported into DevonThink with the kind: Document !

The PDF will not preview from within Devonthink - instead showing a pixelated CD disc with a rainbow shooting star icon.

Right-click, open on the PDF opens a window showing a more significant pixelated CD with a rainbow shooting star icon.

Right-click, Open with → Preview displays the PDF file as expected.

There doesn’t appear to be any way to view the PDF within Devonthink.

Alternatively, if I drag ’n drop the PDF from the Downloads folder directly into Devonthink - the kind is: PDF+Text and the PDF previews within Devonthink without issue as expected.

How does one import the PDF with the “correct” kind of PDF+Text with Applescript and prevent the “Document-kind” from beaming in?

What’s the name & extension of the imported file used in the script?

What browser are you using?


Credit%20Card%20Statement%202018-Jan-05.pdf is the downloaded file via Safari, Hazel renames to 2020-10-05 - Sep 9 to Oct 5 - Bank Visa.

Ah hah! Looks like the pdf extension is missing on my Hazel rename…

Updated the Hazel rule to add .pdf - boom, it’s working as expected now.

Thank you @cgrunenberg

1 Like