automatically saving note from template to specified group

Hi all,

I have a template for creating new notes and I would like all of the notes I create using the template (assigned to a hot key) to be placed in a specified folder regardless of where I create them. Is there any way to accomplish this through the script that produces the template?

I do have a way of automatically adding a certain tag to the note and then replicating any file with that tag to an indexed folder that is then deconsolidated, however just placing notes directly into this folder without the tagging step in between (and having to remember to utilize the second script) would be a very big help. Also, the second method only works for files created directly within the specified database. I’d like to be able to create notes globally, or even when DEVONthink is open but not the frontmost app, and have them all placed in a specific place if possible. I know that I can do this via the sorter but this option doesn’t allow me to use the note template with my predefined structure and metadata.

It’s entirely possible that this is, of course, not possible, or else beyond my extremely limited scripting abilities, but I thought I’d check.

? How are you creating a note from a template if DEVONthink isn’t the frontmost app?

Hi Jim,

Thank you for your response and sorry for getting back to you so late.

You’re absolutely right; my only way of bringing DTPO to the front of the window is through scripting another app like KM or Alfred.

So, recognizing that fact, and simply using DTPO as the frontmost app, is there any way to specify a particular indexed group for a new note to appear in? I’ve adapted the script for generating new markdown notes into a couple of different formats (annotation, note, general text) and would like for each of these to be placed in a corresponding indexed folder upon generation. Currently I do this via auto-tagging, replicating, and then moving to external folder via two scripts (the template that creates and tags the note and the script that replicates all new items with that tag and moves them to their external folder). I don’t really want the replicants in their original location, however, as it’s just cluttering another group–indeed I don’t especially want these to be replicants at all. My scripts only work when I’m in the specified database as well, so if I generated a new note in the global inbox, for instance, it woudn’t be sorted properly by the scripts.

I have these templates in the toolbar and just click on each to generate a new file when required. Could I add anything to the Applescript to have them moved to the required group immediately upon generation?

Thank you again for your help!

So your script is creating three different types of documents?
And each of these documents have a specific group they should reside in, NOT mixed in with the other types?

No, sorry, I have 3 different scripts for generating markdown templates, whether for a short note, to make reading notes on a document, or else for a general text that might be a short paper or abstract or funding application, etc. Each has the same base but pulls in different info from different places in creating the metadata and internal structure of the document. Currently, each is taggred with one of 3 tags corresponding to the type at the moment of creation. I then trigger a script that creates replicants into one of 3 folders based on this tag and then exports to the external indexed folders.

So yes, the files tagged “notes” (or whatever) should be in the notes file, for instance, regardless of the group I happen to be in when I trigger the template, although the necessity for tagging is more just a means of identifying and distributing the document to the appropriate group at present. If I were to be able to tell DTPO specifically where to put these in the initial creation script, then I might remove the tagging portion of the script. I would also then not require the script for creating replicants of the tagged documents and my database would ultimately be a bit less cluttered and a bit more efficient.