Automatically assigning prototypes to sub-folders?

(Ikem Nzeribe) #1

Hello! I have a folder for my working projects. I’d like to turn assign every sub-folder a “project” prototype automatically every time I create one, without doing it manually, and for the notes within to become tasks (*todo).

I know that it has something to do with $OnAdd and parents and children, and is related to this post, but can’t understand how to handle folders.

Any clues? Thanks.

(eastgate) #2

A container’s OnAdd action is performed when a note is moved into, or created inside, that container. So, if we want notes created inside Cabinet to use the prototype projects, the OnAdd action for Cabinet would be


(Mark Anderson) #3

In your case (going from the screenshots) your project prototype is called *project. So in your own document the OnAdd code needed for container “Awards & funding for business” would be:


i.e. any note added to the container—as new or an existing one dragged into it—will have its Prototype attribute set to the case-sensitive name of the prototype you wish it to use: here it is *project.

The easiest way to set this code is using the Action Inspector’s ‘action’ tab. Select the container whose OnAdd you wish to see. Then:

  1. Press keyboard shortcut Cmd+1 to open the Inspector window.
  2. Select the Action Inspector using the right-most (cog-wheel) icon in the top row (#1 in screengrab below).
  3. Click the ‘Action’ button in the lower row of buttons (#2 in screengrab).
  4. Type or paste your code into the main box (#3 in screengrab).
  5. Press the Return key to complete the edit - you can tell the code is set as it will now all be selected.
  6. You’re done! You can close the Inspector and you are ready to try our your OnAdd action by adding a note to the container.

(Ikem Nzeribe) #4

Thank you. I think my query is essentially this one, answered previously.