DevonThinkPro Office

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

Moderator: Mr_Noodle

DevonThinkPro Office Wed Jan 22, 2014 12:21 pm • by kelpie
Hi folks

I want to set Hazel to import particular files into DTP Office. I understand this can be done via either AppleScript or Automator but as I am useless with both I wonder if anyone already has such an item they are willing to share?
It would be much appreciated.

Many thanks.

Pat
kelpie
 
Posts: 20
Joined: Mon Mar 14, 2011 7:08 pm

Re: DevonThinkPro Office Sun Mar 16, 2014 3:36 am • by Cassady
Pat - would it not simply involve having Hazel place specified files into the Global Inbox for DTPO, as located in Finder?
Cassady
 
Posts: 47
Joined: Wed Mar 06, 2013 4:34 pm

Re: DevonThinkPro Office Sun Mar 16, 2014 4:51 am • by kelpie
Hi
Thanks for the reply. Yes, that would be an option, and I hadn't really thought of that.
However, I have since managed to develop a system using folder actions that seems to work for me.
Thanks again.
kelpie
 
Posts: 20
Joined: Mon Mar 14, 2011 7:08 pm

Re: DevonThinkPro Office Tue Mar 18, 2014 5:36 pm • by redcliff
Pat,

Would you mind sharing your solution? I am new to Hazel and am trying to figure out if I can get it to import files into a particular group of a particular database.

Red
redcliff
 
Posts: 11
Joined: Tue Mar 18, 2014 5:27 pm

Re: DevonThinkPro Office Tue Mar 18, 2014 6:38 pm • by kelpie
Hi

I just use Hazel to direct files to folders such as one for PDFs. Then use the folder actions to import the PDFs but they go to the global in box. I don't think this is what you are looking for.
kelpie
 
Posts: 20
Joined: Mon Mar 14, 2011 7:08 pm

Re: DevonThinkPro Office Thu Mar 27, 2014 8:45 pm • by roddyt
This is pretty simple to do using Automator. I monitor my Downloads folder for various kinds of files. For each type of file, I have created an Automator workflow to move it to the appropriate DevonThink group.

Open Automator, select File > New
Select Workflow as the type of document.
In the leftmost Library column you should see DEVONthink Pro Office (I don't know if this appears for all versions of DT)
Select it, then in the next column double-click Set Current Group or drag it over to the open area to the right.
Select your database, then expand the arrow in the Select Group box. Highlight the group you want to import to.
Go back to the list of DT actions and double-click or drag Add Items to Current Group. It will appear under Set Current Group on the right.
It is pre-set to Import and doesn't need to be edited.

Save it somewhere convenient. Back in Hazel, select Run Automator workflow in your rule and locate the Automator file you saved.
That's it. When it executes, it will open a DT window to the selected group, so you will see the file being added.

If you want to use this method to send to a different group, you have to create another workflow, but that's easy to do now that you have one created.
Either open the workflow you created, or you can double-click the workflow file from the Finder to open it in Automator.
Select File > Duplicate to create a new copy of the same file.
Just change the selected group to another one and save the file.
roddyt
 
Posts: 11
Joined: Thu Mar 27, 2014 7:47 pm

Re: DevonThinkPro Office Fri Mar 28, 2014 6:24 am • by kelpie
Thanks, I'll have a play with that this weekend
Cheers
kelpie
 
Posts: 20
Joined: Mon Mar 14, 2011 7:08 pm

Re: DevonThinkPro Office Fri Mar 28, 2014 12:00 pm • by kelpie
@roddyt

Thanks, that seems to work fine and obviates the need for the extra folder.
One issue I have is that the automator workflow leaves the original file in the downloads folder whereas the folder action would delete the original. I've tried to get Automator to delete the file too but have had no luck, can you give me some idea how this might be achieved?
Thanks.
kelpie
 
Posts: 20
Joined: Mon Mar 14, 2011 7:08 pm

Re: DevonThinkPro Office Fri Mar 28, 2014 3:52 pm • by roddyt
Sure can. You don't need Automator for this. In Hazel, add another action after the "Run Automator workflow". Select "Move" (actually you don't have to as that is the default). Click to open the menu in the folder selection, you'll see "Trash" as one of the options toward the bottom. Select that and you're done.
roddyt
 
Posts: 11
Joined: Thu Mar 27, 2014 7:47 pm

Re: DevonThinkPro Office Fri Mar 28, 2014 7:09 pm • by kelpie
Thank you. I had looked at the 'move' command but had not noticed the 'trash' item near the bottom.

Cheers
kelpie
 
Posts: 20
Joined: Mon Mar 14, 2011 7:08 pm

Re: DevonThinkPro Office Mon May 19, 2014 7:08 pm • by celsee
I'm having an issue in that I can't get the OCR action to work after I use Hazel to monitor the Downloads folder and move PDFs into my DTP Inbox. My trial run of Hazel is almost over, and I really want to get this to work. While I've set up some other nifty things for Hazel to do, this flow is the primary purpose Hazel would serve for me. (It's been on my list to check out for a loooong time, because it's so well received.)

There is something wrong with the Automator workflow that I just can't figure out. It is as follows:

Set Current Group
Add Items to Current Group
OCR

The Hazel rule itself just says to scan Downloads for PDFs that have been there x amount of time, run workflow, trash original.

I've tried countless variations, to no avail. The log says:

2014-05-19 16:03:34.092 hazelworker[5908] Error executing Automator workflow /Users/xxx/Desktop/Test import.workflow: Error Domain=com.apple.Automator Code=-212 "The action “OCR Items” encountered an error." UserInfo=0x7fe4c0f32ec0 {NSLocalizedDescription=The action “OCR Items” encountered an error., NSLocalizedFailureReason=No items in input!, NSLocalizedRecoverySuggestion=Check the actionʼs properties and try running the workflow again.}
2014-05-19 16:03:34.092 hazelworker[5908] [Error] Automator workflow failed: Error executing automator workflow /Users/xxx/Desktop/Test import.workflow on file /Users/xxx/Downloads/Instability in Europe After Cold War.pdf.

When I run the rule, it'll actually loop and add the same PDF 4, 5, 6 times until I shut it off. I can't figure it out. If I remove the OCR action from the workflow, Hazel executes the process and it all works fine and dandy.

Does anyone have any thoughts on this? I just want to

1. Search Downloads for PDF
2. Move items to DTP Inbox
3. Run OCR

Something about the OCR part of the workflow breaks the whole system. Any thoughts would be greatly appreciated. I think Hazel is great, and I can probably use it for a lot of other things, but this is the primary reason I want Hazel, so I want to make it work!

Thanks.
celsee
 
Posts: 4
Joined: Mon May 19, 2014 6:37 pm

Re: DevonThinkPro Office Mon May 19, 2014 7:41 pm • by celsee
And after I post this, I finally figure this out. The workflow needed to "Get Items from Records" first. Fantastic! :D
celsee
 
Posts: 4
Joined: Mon May 19, 2014 6:37 pm

Re: DevonThinkPro Office Tue May 20, 2014 4:29 am • by kelpie
Hi
Where abouts in the workflow did you put that 'get' command?

Cheers
kelpie
 
Posts: 20
Joined: Mon Mar 14, 2011 7:08 pm

Re: DevonThinkPro Office Wed May 21, 2014 2:50 pm • by celsee
Put it in there after the "Add items" command. I'm having an issue with figuring out how to delete the original file from DTP's Inbox after the command. It's not treating the moved file as an "incoming scan" and thus doesn't delete the original. I'm sure there's a way to figure it out, but my trial ended so I can't fiddle with it anymore.
celsee
 
Posts: 4
Joined: Mon May 19, 2014 6:37 pm

Re: DevonThinkPro Office Wed May 21, 2014 2:52 pm • by celsee
Workflow is this:

Set Current Group
Add Items to Current Group
Get Item from Records
OCR

The Hazel rule just looks at Downloads, runs the Workflow, trashes the file from Downloads.
celsee
 
Posts: 4
Joined: Mon May 19, 2014 6:37 pm

Next

Return to Support