New note with template

I have a script I use for quickly creating a note in DT Pro:

display dialog "Title of note:" default answer "" buttons {"Cancel", "OK"} default button 2
set theTitle to the text returned of the result
set theText to ""
tell application id "com.devon-technologies.thinkpro2"
	set theNote to create record with {name:theTitle, type:txt, plain text:theText} in incoming group of database "main"
	open window for record theNote
end tell

Two questions:

  1. How would I modify this to create a rich text note instead of a plain text? Just changing “type” to “rtf” and “plain text” to “rich text” doesn’t seem to do it.
  2. How would I create the note with a specific template?

Thanks to anyone who can enlighten me.

That’s a bug, the next release will support all of the following alternatives:

tell application id "com.devon-technologies.thinkpro2"
	create record with {name:"Test1", type:rtf, content:"Hello"}
	create record with {name:"Test2", type:rtf, plain text:"Hello"}
	create record with {name:"Test3", type:rtf, rich text:"Hello"}
end tell

Thanks, Christian. Er, what about the template?

Use the path of the template in ~/Library/Application Support/DEVONthink Pro 2/Templates.noindex and then simply…

tell application id "com.devon-technologies.thinkpro2"
	import "<InsertPathToYourTemplateHere>"

Great to know these alternatives will be added. How about being able to set the state and state visibility booleans?

I’ve written an applescript studio program that sits on my desktop so I can send quick plain-text and rich-text notes to DT2 as well as I’m trying to figure out how to send a ToDo item to DT2. Any suggestions?

Why don’t you set them for the created record?

Because I didn’t think of it?

After getting event handling errors while trying to set the created record’s type to rtf, I didn’t think to try that with the state/visibility elements. Now the checkbox works for me, thanks for the little push.

Can I do the same with the Sorter? Can I write a script that will allow me to create rich text entries in the Sorter’s inbox? Or one of the other items in the Sorter? Please. Pretty Please.


Of what use would that be except for that DEVONthink would not need to be running?

DEVONthink not running is very important for me. TimeMachine for instance is saving every hour hundreds of MBs, even when I imported only a few of them.

Due to a broken (right) arm I have not been able to really write these last 2 months. Holding the mouse with my left hand I was glad collecting items using the Sorter. The benefit has been that my iMac G5 with plenty of RAM and available space on the harddisk did not slow down, TimeMachine’s backups did not grow 2GB every day and, most important, the desktop stayed clean and uncluttered.

For writing I use Scrivener, importing research items for a specific project from DT in there. DT will only be opened, when needed. For quick notes I’m using Things. These notes are imported via drag and drop to DT when needed.

The point is to be able to do it ANY time. In any app. regardless of whether I have opened DevonThink or not.

Isn’t this why you created the Sorter in the first place. To be able to place content from any app there any time? It seems that DevonThink gets the concept that we might be inside any number of applications at any time and want to clip any information we come across. But you have not made the leap yet that the application we are in most of the time is our head. And we want to get something out of our head and into our inbox as quickly and with as few interruptions as we possibly can. I want to be able to capture my brain farts almost without disturbing what I cam currently doing. So the smallest number of key strokes as possible. I don’t wanna move my head. I don’t wanna move my hand to a mouse. I don’t want to click something in the dock… I want to hit ctrl+space and start typing. Hit enter… and voila. I know that my thought is stashed away somewhere safe… somewhere that I can find it later…

I guarantee that if you implemented something similar to the OmniFocus quick entry window, active resistance to your application will melt away. People will not be applauding you for having the feature, they simply will not notice you don’t have it.

This would indeed be a very useful feature. It occurs to me that one could probably use launchbar or quicksilver to kludge together something to do this. But of course this doesn’t help those who don’t use either of these (and I haven’t actually tried doing it yet so am not sure it can be done…).