While the default type of a new Sorter document cannot be changed, you can use a custom template combined with AppleScript, an Automator Service, and a Keyboard shortcut to create new RTFD documents in DT, by pressing a hotkey. This technique interacts with DT directly and bypasses the Sorter. It has a few drawbacks and idiosyncracies, but you may find it useful.
Before getting into the details, I’d like to add to BLUEFROG’s feature request one of my own: enhancing the “create record” AppleScript command to allow creating new records based on templates and evaluating placeholders in the process of creating such a template-based document. (And in the process, fixing the apparent bugs in the create record command that prohibit creating trf and rtfd document types, which would have eliminated the requirement to use the Import command instead.)
And, I agree with BLUEFROG that being able to set the Sorter’s default document type to RTFD would be very useful.
==============================
Broadly, the steps are:
I. Create a template for a new RTFD document.
II. Use Automator and Applescript to create a Service that imports the template into the DT group of your choice.
III. Bind the Service to a Keyboard Shortcut.
Here are the detailed steps. It looks like a lot of work, but it’s quite simple, just a bunch of steps.
==============================
I. Create a template for a new RTFD document.
-
Create a blank document in TextEdit or other text editor that can save as RTFD. If you wish, add boilerplate, set different fonts and text colors, insert tables, and so forth. (See the “Notes” section below if you want to use any of the DT placeholders such as %longDate%.)
-
Save the file as “New RTFD document.rtfd” in your ~/Library/Application Support/DEVONthink Pro 2/Templates.noindex folder.
==============================
II. Use Automator and Applescript to create a Service that imports the template into the DT group of your choice.
- Run Automator.
- Select Service and click Choose.
- Choose: Service receives [no input] in [any application].
- Drag a Run Applescript step into the workflow.
- Delete all of the text in the AppleScript step and copy and paste this script:
on run {}
tell application id "com.devon-technologies.thinkpro2"
set theLocation to display group selector
import "/Users/**your user name**/Library/Application Support/DEVONthink Pro 2/Templates.noindex/New RTFD document.rtfd" to theLocation
end tell
end run
In the script, replace your user name with your user name as it appears in Finder. This is the path to the RTFD template document that you created.
- Save the Service as “New RTFD Document in DEVONthink”
- Quit Automator.
==============================
III. Bind the service to a Keyboard Shortcut.
- Run System Preferences.
- Click on Keyboard.
- In the Keyboard pane, click on Keyboard Shortcuts.
- In the left-hand list, select Services.
- Scroll the right-hand list to find the “New RTFD Document in DEVONthink” that you created. (If it does not appear, log out and log in, and run System Preferences again. Sometimes new services do not show up in this list. I believe this is a bug in OS X.)
- Enable the service by checking its box.
- Double-click in the right-hand portion of the service’s entry. A field appears where you will press the keys that you want to trigger the service. Your keystroke must not already be in use.
- Quit System Preferences.
==============================
Test your service by pressing the hotkey you assigned to it. A list of open DT databases will pop up: this is the Group Selector. Navigate to the location where you want to save your new document and click OK. A document named “New RTFD Document” will be created in the location you specified. You can drag and drop items into it.
Notes:
- This has been tested with DT Pro Office; I assume it will work with other DT versions too.
- DT’s group selector displays only databases that are open.
- Because this approach uses a template, in DT, you can click the Actions button on the toolbar and select “New from Template.” Your template will be in the list. Select it and DT will use your template as the basis for a new document.
- When manually creating a new document from a template, DT will evaluate placeholders such as %longDate%. But, since (as far as I can tell) it is not possible create a document from a template using scripting, the script must Import the template, and DT cannot evaluate the placeholder. (Importing is simply copying an item into a DT database.) So, the placeholder text remains in the new document. (Creating a new document from a template might be possible through GUI scripting, but this technique is easily broken.)
- The new document’s creation date will be the same as the template’s creation date. This is another side effect of Importing the document.
- DT will not get the input focus after you create the new document. You must navigate to DT to work on the document.
If you ever want to delete this (or any other) service:
- Disable the service in System Preferences - Keyboard - Keyboard shortcuts by unchecking its enabled box.
- In a Finder window, navigate to: /Users/your user name/Library/Services
- Delete the “New RTFD Document in DEVONthink.workflow” service.
- Empty the Trash.
Perhaps one or more of the more experienced DT scripters can enhance this script. Some things that come to mind are:
- Prompting for a name for the new document
- Setting the document’s content to any text selected in any application
- Changing the creation date of the new document to that date/time it was imported.
- Setting the input focus to DT after the template is imported.
This is not an ideal solution, but you may find it useful as a workaround.