Sequential numbering of notes

I need to make 190 notes. I want to name the first one “Conf_Pro 1” and the last one “Conf_Pro 190”. I also have an attribute named Conf_Pro_ — it is a number. What’s the most efficient way to make the notes? Thanks.

HI Bryan,

There are multiple ways to do this inside TinderBox. I would demonstrate one using stamp methods

  • Assumption - You’ve an attribute Conf_Pro_ which contains the note number you want
  • You can create a stamp by going to Menu-Inspect Stamp- (Press Plus Button, Give your stamp a name)
  • Use Action as below $Name="Confi_Pro "+$Conf_Pro_
  • You can select all the notes , apply stamp

Please see file attached

Bryan.tbx (73.1 KB)

(I’ve answered wrong question , you want to make 190 notes in 1 go, apologies)

Conf_Pro_

Copy the above text 190-times in a text editor including paragraph (use an editor where you can see line-numbers) .

Copy the entire text in the clipboard (Cmd+C)

Open a new Tinderbox file

Insert the Clipboard into the Tinderbox file (Cmd+V)

Select the inserted note and run menu Note->Explode. Use Option Break at paragraphs.

Switch to Outline View and select all notes “Conf_Pro_”.

Run the following command in Inspector/Stamps:

$Name = $Name.replace(“Pro_”,“Pro_”+SiblingOrder)

Hope this helps.

4 Likes

This is NOT the 1 magic trick answer but will require you to press enter 180 times

  • Create a container in Outline mode ,where you want your notes to live
  • Create an on ADD action (Select Note, Press CMD+1, go to last option with circle in 3 DOTS), select Action

$Conf_Pro_=$Conf_Pro_(prevSibling)+1;$Name="Confi_Pro "+$Conf_Pro_;

You can children note which would be named as your scheme

Nice ! Something new I learned !

That’s going to work. Thanks.

The proposed methods, stamp, explode with action code, are two very effective ways, but they do offer some constraints.

There are some alternatives.

Couple of questions. Have you already made the notes in TBX, or are they in a spreadsheet? Will you ever want to re-order the notes? Change their prefix? Will you ever want the note titles without the Conf. Prof.? Is the numbering primarily for visual semantics or operational purposes?

If you want to add flexibility to your files, e.g. retain the original note name while getting what you asked for, you could create a prototype with a rule, apply the prototype to the notes, and stick the notes in a container. You can also consider creating a $DisplayExpression.

Exactly how you got about doing this will depend on your answers to the first question above, i.e. are the notes in your TBX file yet or not? Basically, what is their current state. Once I understand your starting point, I’d be happy to show you various tricks (do you have sample data or file you can share).

1 Like

If you have to create sets of notes more than once then a simple external script will do the job with one click:

set containerName to "Sequential Notes" -- Change to name of root level container where you want the notes

tell front document of application "Tinderbox 8"
	repeat with i from 1 to 190
		set newNote to make new note at note containerName with properties {name:"Conf_Pro " & i}
	end repeat
end tell

And, getting a little fancier, a short script can also easily create the container and attribute if they don't already exist and populate the attribute with the number in the sequence.
set containerName to "Sequential Notes" -- Change to name of root level container where you want the notes
set attributeName to "Conf_Pro"

tell front document of application "Tinderbox 8"
	if not (exists note containerName) then
		make new note with properties {name:containerName}
	end if
	if not (exists attribute attributeName) then
		set newAttribute to make new attribute with properties {name:attributeName, type:"number"}
	end if
	repeat with i from 1 to 190
		set newNote to make new note at note containerName with properties {name:"Conf_Pro " & i}
		set value of attribute attributeName of newNote to i
	end repeat
end tell

Usage:

Step 1: Copy-paste one of the scripts into Script Editor (in Applications > Utilities).

Step 2: With a Tinderbox document open, click the run button in Script Editor.

Step 3: No step three.

(If “nothing happens” make sure Script Editor is listed and checked at System Preferences > Security & Privacy > Privacy > Accessibility.)

1 Like

This is great. At first pass, I did not see there were two scripts here. Script 1: create the 190 notes; Script 2: create notes and name them with the attributes. Works great!!!

Another approach:

  1. Make a sequential attribute $Seq
  2. Make a bunch of notes
  3. Set the $DisplayExpression of these notes to $Name+$Seq
4 Likes

For those curious about this, a sequential attribute is an attribute set to data type “number” and the sequential check boxed checked.
image

7 Likes

Dear Sumner Gerard,
Thank you very much for the great script.
May I ask a question?
How can I change the name at {name: "Conf_Pro " & i} to “Note”
and add “time” to the “i” “number” place?
( $Name=Note_ + date(today).format(“y-M0-D h:mm:s”); )
How do I get a sequential numbering of notes with both “name” and “time”?
I am sorry to bother you, but could you please teach me how to write the script?
Respectfully, WAKAMATSU

Dear Sumner Gerard,
I try to figure out how should I add date (“y-M0-D h:mm:s”)
But
set newNote to make new note at note containerName with properties {name:"Note_ " & i & “-” & (current date)}
shows in my note like this,
Note_ 1-2021年6月29日 火曜日 22:27:34
How could I setDateFormat:“y-M0-D h:mm:s”
Note_ 1-2021-6-29 - 22:27:34 like this ?
Respectfully, WAKAMATSU

Hi! To format the date as a more name-friendly string you could consider something like this:

set containerName to "Sequential Notes" -- Change to name of root level container where you want the notes
set attributeName to "MyAttribute"

set isoDateStr to (current date) as «class isot» as string --> 2021-06-29T23:31:58
set formattedDate to text 1 thru 10 of isoDateStr & " - " & text 12 thru -1 of isoDateStr

tell front document of application "Tinderbox 9"
	if not (exists note containerName) then
		make new note with properties {name:containerName}
	end if
	if not (exists attribute attributeName) then
		set newAttribute to make new attribute with properties {name:attributeName, type:"number"}
	end if
	repeat with i from 1 to 190
		set newNote to make new note at note containerName with properties {name:"Note_ " & i & "-" & formattedDate}
		tell newNote
			set value of attribute "Width" to 5
			set value of attribute attributeName to i
		end tell
	end repeat
end tell

If you want each note name to show a slightly different time then you could move the two date-related lines within the repeat loop and add a delay statement, something like this:

set containerName to "Sequential Notes" -- Change to name of root level container where you want the notes
set attributeName to "MyAttribute"

tell front document of application "Tinderbox 9"
	if not (exists note containerName) then
		make new note with properties {name:containerName}
	end if
	if not (exists attribute attributeName) then
		set newAttribute to make new attribute with properties {name:attributeName, type:"number"}
	end if
	repeat with i from 1 to 190
		set isoDateStr to (current date) as «class isot» as string --> 2021-06-29T23:31:58
		set formattedDate to text 1 thru 10 of isoDateStr & " - " & text 12 thru -1 of isoDateStr
		set newNote to make new note at note containerName with properties {name:"Note_ " & i & "-" & formattedDate}
		tell newNote
			set value of attribute "Width" to 5
			set value of attribute attributeName to i
		end tell
		delay 1
	end repeat
end tell

How about using a display expression for something like

$Name+":"+$Created("l")

Also consider the new .next operator, which is useful for generating series of names like “Note_03”, “Node_04”, etc.

Dear Sumner Gerard,
Thank you very much for the nice scripts.
I can not find the way after this setting subsequent [set formattedDate to].
[set formattedDate to text 1 thru 10 of isoDateStr … ]
I could take it a step at a time and enjoy a very prosperous definition under your guidance.

First of all, thank you.
Respectfully, WAKAMATSU

Dear eastgate,
Thanks a lot for instructing your .next operator.
I will give it a try.
I will report on my progress later.
Thx and regards, WAKAMATSU