Page 1 of 1

Bookends attachments folder and DevonThink database

Posted: Sun Feb 15, 2009 2:11 pm
by frvs
I wonder, would it be possible to somehow keep my BE attachments folder inside the DevonThink database? Presently I keep that folder in /Documents/ and simply synchronize it in Devonthink so as to be able to search and view all attachments within DT. But whenever I wish to run a PDF attachment through the DevonThink OCR engine things get complicated because DT actually imports the document. So then I have to export the newly generated searchable PDF to the BE attachments folder, erase it in DT, and finally I must synchronize the Bookends attachments folder anew. Kind of tiresome in the long run... Any ideas, suggestions? Thanks.

Re: Bookends attachments folder and DevonThink database

Posted: Mon Feb 16, 2009 1:49 am
by Rudi_Grams
No idea if that is possible and I also do not have the Office version to test the scanning but you could try to automate the task using applescript. The following script is a simple demonstration and works only if you have a single attachment folder (no subfolders). It is also necessary to have the the scans in the same group in DT before you run the script. Take care that the script will delete the original file, so test with copies first!

Rudi

Code: Select all

--set the correct path for AttachmentsFolderPath!
--it works only if you have a single Attachment folder
--it works only if the scans are in the Attachments group in DEVONthink

set AttachmentsFolderPath to "/Users/Username/Documents/BookendsAttachments"

tell application "DEVONthink Pro"
	set file_list to selection
	if file_list is not {} then
		set myParent to parent of item 1 of file_list
		set myParent to item 1 of myParent
		repeat with c from 1 to count of items of file_list
			set myName to filename of item c of file_list
			-- if you want to keep the original file then delete the next 2 lines!
			set myFile to quoted form of (AttachmentsFolderPath & "/" & myName)
			do shell script "rm -f " & myFile
			export record item c of file_list to AttachmentsFolderPath
			delete record item c of file_list
		end repeat
		synchronize record myParent
	end if
end tell

Re: Bookends attachments folder and DevonThink database

Posted: Mon Feb 16, 2009 9:17 am
by frvs
Thank you, thank you, thank you! Works like a charm. :D

Re: Bookends attachments folder and DevonThink database

Posted: Thu Feb 19, 2009 7:18 am
by hendrix
If I understand correctly, the script keeps the attachment in BE's attachment folder, and syncs it with DT. Would it be possible to tell BE that the attachment is in the DT database (a package the Finder can see)?.

Just as a wish: Imagine I'm in DT viewing a pdf document I've imported into DT. Would it be possible to write a script that tells BE to create a new record, attaches (without moving/copying it) the selected pdf in the DT database to the record and, and lets me fill in the data in the BE record? Whenever I get to the BE record I shuold be able to see the pdf in the DT database.

Just to jump into science fiction: if it could read (if there are) the DOI and (in the future) OpenMeta tags and fill in the fields that match...

Regards

Manuel

Re: Bookends attachments folder and DevonThink database

Posted: Thu Feb 19, 2009 8:09 am
by Rudi_Grams
Bookends is not scriptable, DEVONthink is. So you cannot automate the creation of a new record in Bookends. Eventually future versions of Bookends will be scriptable. The chance for this will increase with the number of users asking for it. As for the location of the attachments, maybe Jon can let you know whether it is possible to specify an attachment folder inside a package and if there are any disadvantages.

Rudi

Re: Bookends attachments folder and DevonThink database

Posted: Thu Feb 19, 2009 11:15 am
by Jon
Hi,

I think you could attach a file in a package if you opened the package and performed a drag and drop. Offhand I can't think of a reason this would be a bad thing to do (but make sure to tell Bookends not to move the file when it is attached).

Jon
Sonny Software

Re: Bookends attachments folder and DevonThink database

Posted: Sun Feb 22, 2009 4:40 pm
by danzac
I'm still in the process of learning how DT's new database structure functions. If it is in one folder in the database, will it stay there forever? If so, this type of attach would be very good indeed. But if I move that pdf in the database, will it move folders in the actual package? You'd also have to be sure to never rename your database.
An option is to keep all your pdf's in DT, and just use local DT URL's in BE to link to the pdf.