I have a note caled “1 note”. Which modifier keys do I have to press when dragging the note to create a new note with the name “2 Note”. I recall successfully doing this a couple of weeks ago; but, now cannot remember. Thank you
if you add the following code in the Action panel:
$Name = $SiblingOrder + " Note";
Then alt and dragging works . You have to sequentially Alt + drag the newly created note.
Naming of duplicated notes notes that numbers at the end of a note are detected and incremented. But, not at the beginning.
Option (⌥) drag duplicates a note, so that doing this to “1 note” creates “1 note copy” as expected having read the note above.
For the newer user, it helps to known the ‘Action panel’ described here is the Action Inspector. That, for a normal container†, shows the code for the containers’s OnAdd action ($OnAdd). So what is happening here?
The container OnAdd fires whenever a new note is added to the container—either dragged into it or newly created.
Thus the Option+drag duplicates the source note, i.e. creates a new note which duly invokes the parent container’s OnAdd, causing a rename.
A side note on the numbering. The above method work but only if duplicating the original ‘note 1’. It turns out the duplicated note is added as the previous sibling of the source note‡. If I drag-duplicate ‘1 note’ I get “2 Note” (N.B. change of case of ‘Note’). If I then duplicate ‘2 Note’ I get another ‘2 Note’. Depending on how you work this may or may not be an issue.
†. For an agent it holds the code of the agent’s action ($AgentAction).
‡. I only just discovered this. Generally the difference is moot, except in an edge context like this!
@mwra Thank you!
When I Alt + drag the duplicated note the new note get a sequestial number in its name: Note 1 → Note 2 → Note 3
However, if I alT + drag the original, it restarts i.e. get ‘Note 2’ i.e.
Note 1 → Note 2
Note 1 → Note 2
Thank you!
Auto-numbering has an implicit (unstated) assumption that the numbered source item is last in any sequence. This might seem lazy but figuring out the ‘correct’ number is the sort of think humans do in a flash and which might keep an AI spinning it’s wheels for ages and the constraining factors are themselves implicit and not necessarily inferred.
If you can bear to use ‘Note 1’ as opposed to ‘1 Note’ then you should be able to leverage existing auto-numbering, or else you might want to mail in a future request to allow the number at start of $Name (I’ve no idea if that is more complex to do).
also ask you self is the number in the $Name of necessity, or only for a visual prompt. For instance, if you leave the number out, a Display Expression like:
$SiblingOrder + ". " + $Name
… might help:
Thank you. Interestingly the code you provided also adds the number at the end (for me)
Forgot to add…
The generic point here is to not lose post of the original need, e.g. “what sequence number in the list is this?”† and get lost in the action code task.
†. This may be obvious in Outline view, less so in a map view. (Why? See)
Likely because of Naming of duplicated notes.
sequential_naming.tbx (74.4 KB)
I have attached the test file. Thank you
