Moving Inbox Notes to specific folders in my DB

Hi…

  • I have bunch of notes that created by my in INBOX → I’m kinda of lazy people to arrange the Inbox notes. → this is really problem… → I left all my notes in Inbox - hard to find and categorize it.

  • Need to move the Inbox notes to folders in my DB. → again, I’m very lazy to move that notes using mouse drag & drops with thinks of which folder I should move to… :smile:

  • Is DV3 offering any smart way for this? I’m looking for such way… I put some tags or notes or any keywords in my Inbox notes. then, when I need to move the notes… I may run script or command or any built-in features in DV3 to move the Inbox notes to relevant folders with the information of tag or comments or keywords that I have entered. Of course, the tag, comments, or keywords should be one of my folder names in my DB.

Thanks for your attention; looking forward your help.

Aaron

1 Like

I use an Applescript to process my InBox notes
Processing includes moving the notes to the appropriate database/group

May I shyly point you at this?

It is possible though that Smart Rules with their on-board features will do everything you need already. The advantage of a script like that is that all the sorting is a) done in one place, b) in exact the order you want, and c) because of the latter allows a fall-back destination for everything that has not a specific destination.

1 Like

that sounds very charming. for me, need to know how to start.

wow. things also working for me. need to read through your article to apply it to my case.

I do this using Smart Rules. Here’s my scheme.

I define a keyboard shortcut in DEVONthink for the “Take Note” panel (see the Preferences, in the panel for Sorter, the “Take Note Hotkey”.) This lets me pop up the note taker panel at any time, no matter what application I’m using at the time.

I established a convention for myself for writing quick notes: I start those notes with @ followed by a keyword, such as @self, @family, etc. Here’s an example of what I mean:

Then, I have a set of Smart Rules, one for each destination corresponding to the keywords. Here’s an example:

The condition tests the name of the note against the keyword. (If you don’t type a name for the note, DEVONthink uses the body; this is why testing the name is enough and you don’t need to test the body too.) The actions do things that fit my needs, and you would probably want to do something different, but the gist is:

  1. move the note to the destination folder
  2. remove the keyword from the note’s name (i.e., the final note will not have @self in the name, because I find that pointless once it’s filed in the destination folder)
  3. prepend the current date to the note’s name
  4. mark it as read and give it a specific label

Again, you would probably want to change the actions to suit your needs.

4 Likes

Here’s a basic script to move selected records

tell application id "DNtp"
	set selectedNotes to get selection
	repeat with theNote in selectedNotes
		set theFilingGroup to get record at "/🗂Filing" in database "Devonthink"
		--
		-- Additional code to refine value for theFilingGroup
		--
		move record theNote to theFilingGroup
	end repeat
end tell

My script has additional code to set filename, tags …
I added the script as a toolbar icon

1 Like

It’s a lot easier ways to do!! Thanks. I’ll think of applying it in my ways. btw, @self(.*) => is this reg exp for …? everything start with “@self”? also, what does “change name to \1” do? and how did you add “Short Creation Date”. Sorry for too many questions and appreciated your help and astonished by your knowledge. Aaron

In this particular case:

  • the expression .* means “match zero or more characters of any kind” (in other words, match anything/everything)
  • parentheses in the search expression means “store the results of the pattern inside the parentheses”, which in this example, is .* So, the expression (.*) means “match zero or more characters and store the results”.
  • the expression @self(.*) means “match the sequence of characters that begins with @self followed by zero or more characters and store the matched characters after the @self part”
  • the expression \1 means “substitute the first parenthesized match”, so in other words, the results of whatever matched .*

Basically, the two things work together to do the following:

  • look for @self in the name and store what comes it
  • replace the name with the stuff that came after it

Example: @self this is my note becomes this is my note.

As to the date part of the rule, what’s happening is not obvious. When DEVONthink executes the actions in the smart rule, it does them in the order listed in the rule. When it gets to the line involving the date, by that time, it has already changed the name of the note to this is my note. The value of the current name of the note is accessible using the placeholder Name. So, the line involving the date ends up replacing the current name (which by that time has been changed as just described) with a new name that consists of the date followed by that current name.

Example: this is my note becomes 2021-05-12 this is my note.

Important: to insert the placeholder Name, control-click your mouse in the field of the dialog box and look for Insert Placeholder in the pop-up contextual menu presented by DEVONthink. (This is the only way to insert placeholders – you can’t type the literal word Name or do anything like that.)

Some information about regular expressions can be found in DEVONthink’s user manual, and there are many resources on the web for learning the syntax.

3 Likes

Perfect!! Again, Astonished by your knowledge.