Another fascinating example from Mark A!
On the more mundane points raised here, which perhaps should be split off into a separate topic, though not sure how or where and thus leave that to the moderators …
(It looks, at first glance, as if I should avoid or automatically prune out any semi-colons in note names to avoid ambiguity)
Semicolons have a special meaning as I found out (again) the hard way here. Easy enough to handle as long as one doesn’t forget!
(and it has shown me stamps, which I had somehow missed …)
Stamps are great. I am more comfortable running action code in stamps more than in agents or rules. I showed a rule in the simple example above as that was easier to include in the screenshot.
If you do a lot of your work in scripts outside Tinderbox (a reasonable assumption!) then stamps give you an off-label way to run action code from a script.
First you select the notes in Tinderbox. You can do that manually of course. But also (despite the statement in Tinderbox Help to the contrary) you can easily select multiple notes from a script, with something like this (an example that selects all notes with 1 in their name):
## select multiple Tinderbox notes
tell application "Tinderbox 8"
tell front document
set notes1 to notes whose name contains "1"
repeat with i from 1 to length of notes1
set selection i to item i of notes1
end repeat
end tell
end tell
Then you can run a stamp on those notes from a script with something like this.
## apply Stamp to selected Tinderbox notes
-- http://www.macosxautomation.com/applescript/uiscripting/index.html
my do_menu("Tinderbox 8", "Stamps", "MyStampName")
on do_menu(app_name, menu_name, menu_item)
try
tell application app_name to activate --must bring to front
tell application "System Events"
tell process app_name
tell menu bar 1
tell menu bar item menu_name
tell menu menu_name
click menu item menu_item
end tell
end tell
end tell
end tell
end tell
return true
on error error_message
return false
end try
end do_menu
Stamps need to be set up in Tinderbox manually first. But you can also run action code from a script with no prior manual prep in Tinderbox by creating an agent from the script and having the script set the value for its AgentAction, something like this:
tell application "Tinderbox 8"
tell front document
set myAgent to make new agent
tell myAgent
set name to "MyNewAgent"
set value of attribute "AgentQuery" to "$Name.contains(" & quote & "1" & quote & ")"
set value of attribute "AgentAction" to "$Color=" & quote & "red" & quote
end tell
end tell
end tell
Or create a note from a script and set a value for its Rule…
Lots of new possibilities with the new scripting support!