Moving from Mariner Paperless to DevonThink

Thank you very, very much for your explanation re accessing Paperless files and opening them in DEVONthink. I followed them and they worked perfectly.
Like you, I found my files in folders by year/month. I have about 2,000 files in about 100 different folders and it is not really practical to open each file to find out what it is. Have you found any solutions as to how to identify an individual file short of clicking on it to open it?

I know this is a reply to an old document, but when I try to run this, I get an error:
error "Canā€™t set Ā«class DTcoĀ» of missing value to \"\"." number -10006 from Ā«class DTcoĀ» of missing value

When I call it with:
my addDocument("25-07-2011.pdf", "", "2011-10-19 15:35:39", {}, "CSFB")

and the link highlighted is the first. i.e: set comment of dp to notes
Is there something I need to run first. Devonthink 3 is running in the background when I run the script.

Any help would be gratefully received. Thanks.
(updated to clean the text up)

Please include code snippets in backticks (`) to prevent useless ā€œsmartā€ stuff like quote substitution.
The way it looks now, we canā€™t see what you really used to call the function.

Updated the text to clean it upā€¦

1 Like

I canā€™t reproduce the issue. Hereā€™s my code (using another file, of course):

on addDocument(filePath, notes, importDate, docTags, title)
	tell application id "DNtp"
		set dp to import filePath to (root of database "Test")
		set comment of dp to notes
		set creation date of dp to importDate
		set tags of dp to docTags
		add custom meta data title for "Title" to dp
	end tell
end addDocument

my addDocument("/Users/ck/Desktop/Bildschirmfoto 2024-11-28 um 10.10.49.png", "", "2011-10-19 15:35:39", {}, "CSFB")

If your issue persist, I suggest you run the code in Script Editor and turn on its protocol (Cmd+3).
But I guess that you did in fact use curly quotes in your call to addDocument.

DEVONthinkā€™s AppleScript dictionary explains that import should be followed by a POSIX path (see chrillekā€™s example). In your instance the filePath is not a valid POSIX path, hence the error.

Also, the error message clearly indicates that dp is missing value, which implies that the import command has failed for some reason. Always try to decipher the error message ā€“ it is provided to you for a reason!

I now feel so foolish. I didnā€™t; know about CMD-3 (very much a novice when coming to script/SQL) but it showed up the error. My python program had a typo on the file path. It was only when I tested it on a simple string to compare to your example that I saw the error. ā€˜paperlesā€™ and not ā€˜paperlessā€™.

Anyway, thank you for your patience and advices, and now I can try to migrate in earnestā€¦

Jimmy

2 Likes

I would recommend you try this firstā€¦

Why not?
ā€œ25-07-2011.pdfā€ is a PDF in the current directory, equivalent to ā€œ./25-07-2011.pdfā€. But what the current directory is, is not clear ā€“ it depends very much on the environment the script is run in.

Whatever the current environment of the script might be, itā€™s not the environment of DEVONthink. Therefore the path has to be absolute or relative to the user directory.

I just came across this discussion of importing Paperless files into DT. I am also trying to import files that need an ā€œamountā€ and ā€œdocument dateā€ and saw that you seemed to have adapted chrillekā€™s script to achieve the import. I have been able to use chrillekā€™s script succesfully, but wondered if youā€™d post your revision; my coding experience is limited to a Fortran course I took 50 years ago, though I do have a limited understanding of what is happening here, especially using ChatGPT to decipher.

I love that you said, exactly how I felt tooā€¦ :joy:

The coding above and conversations being held are WAY over my head so I had to find another way to simply get my files into my system as easy as possible and I wanted to share incase this may help someone else.

Your system sounds very promising to meā€¦ I shall give it a crack!.. Thank you.