script for setting first line to Name of Note?

Does anyone have a script for automatically setting the first line of a Note as the Name of the Note?

I appreciate that one can select the first line and then Set Title As from the contextual menu, but that’s less efficient (to me) than something I can bind to a keystroke.

Before DTP2, in List View, Icon View, and Column View, one used to be able to have a new Note open up immediately for text entry (in the other views, selection of the Name of the Note was the default). On Save, the first line of such a Note would then automatically become the Name of the Note. This functionality has now been lost and I’m looking for some reasonable replacement.

With thanks for any suggestions.

1 Like

Select the first line and press Cmd-Ctrl-Option-T (Scripts > Rename > Selected Text)

Thanks for the suggestion, but the functionality I miss is not having to do a thing to name the Note, except Save it.

Next best would be a keystroke that named the completed Note with its first line, simply from within the open Note and without any mousing around; it’s having to select text that has the highest nuisance value.

Well, here’s a super simple script (no error checking, supports only plain/rich texts):


tell application id "com.devon-technologies.thinkpro2"
	set name of content record to paragraph 1 of text of think window 1
end tell

1 Like

Just what I had in mind. Many thanks. I knew it had to be simple. :smiley:

Jim,
I pasted your text verbatim into script editor and saved to <DEVONthink Pro 2/Scripts/Rename>

Why is my script not working?

[dropbox.com/s/2uaf8jy1b59y2v9/why%20script%20not%20working%3F 2017-09-30_1252.png?dl=0]

YOUR TEXT:

tell application id “com.devon-technologies.thinkpro2”
set name of content record to paragraph 1 of text of think window 1
end tell

This is Criss’ script and note what it says…

What type of file are you attempting to use this on?

Hi Jim,
Using on RTf mostly.
It is working now, after restarting DTPO.
However, it will only work on a single file. Not when I select multiple RTFs.
The script I used before worked on multiple files. Lost that one.

How can I get it to rename multiple files?

Thanks!
Joseph