How to get Type of File in Finder

I am trying to write a simple script to use the display group selector to import a file into DT3 from the Dinder

This works fine for PDF files. I cannot find working syntax however to set the type of the file so that I can use it for other type than PDF. If I try for example “set theType to type of theItem” I get an error.

How do I find the type of a selected file and then set that type when creating the record?


Why are you creating a record instead of importing the file?

This does work but it goes into the Global Inbox by default.

I cannot find the syntax that works for “Import” which lets me utilize the group selector


The dictionary shows a to parameter for the import command.

Thank you - that works

Question - if I select multiple files, the group selector requires that I make a response for each item. Is there a way to make one response that applies to all selected items?

If you’re importing multiple items from the Finder into a single location in DEVONthink, why are you using an AppleScript (and Keyboard Maestro) to do this? You could more easily drag and drop them to DEVONthink’s dock icon.

Because the dock icon goes automatically to my Global Inbox and does not let me choose a destination. I know I can change that under preferences, but I have MailMate set up to automatically import every incoming email; if I set the preferences to let me choose the import destination, then I would have to do that choice every time I get an email.

So since I effectively lose the use of the Sorter/Dock Icon due to the way I have set up the MailMate automatic import, I am writing a Finder script that returns that function to me.

I know I can also navigate through the database tree in the sorter but I do not find that to be practical with a large database that has lots of groups. I find the user interface of the group selector to be more user-friendly.

I know I can also navigate through the database tree in the sorter but I do not find that to be practical with a large database that has lots of groups

You search in the Navigation view of the Sorter then drag and drop to it. The Sorter retains the search term for easy filing into the same group.

Yes- but the Sorter does not nominate a best choice when there are multiple matches - you have to manually scroll through and select.

The Group Selector suggests a best choice so I can quickly stop typing when it nominates the correct choice.

The distinction is amplified because with the Sorter I have to visually pick out the destination twice - first when doing the initial search in the Sorter and then a second time when I am dragging the items over. With the Group Selector, it is reversed; I select the item(s) and then activate the Selector so I do not have to go through the search responses twice.

This may seem like splitting hairs - truth is they are both really helpful. But it’s a feature I use heavily and if the Group Selector is an easy 2 steps and the Sorter is a slightly harder 3 steps, then it’s worth writing the script for the Group Selector. That’s the wonderful advantage of being able to script DT3.

On top of that, once I get this working in final form, my plan is to turn the script into a Service which I can activate from the context menu - which would make it even more efficient.

Now if only I could figure out how to make the group selector choice apply to multiple items…