AppleScript note creation into adornment causes temporary container appearance

When using AppleScript to create a note inside an adornment, Tinderbox displays the adornment as if it were a container, until I drag the new note a bit and then the adornment looks like an adornment again.

To reproduce: open a blank document, create an adornment called “INBOX” and then run the following Applescript:

tell application id "Cere"
	if not (exists front document) then error "No Tinderbox document is open."
	tell front document
		set theAdornment to adornment "INBOX"
		set theNote to make new note at theAdornment with properties {name:"Test Note"}
	end tell
end tell

It would be nice if the adornment kept its appearance when a new note is placed on it via applescript. Am I doing something wrong?

Good point. “at theAdornment” was not intended to be supported, but I can see why it parses.

To set the map position of theNote, set its Xpos and Ypos.

My goal is to be able to automatically apply the OnAdd actions of the adornment (set a prototype etc.), to be able to reliably find the new note(s), and easily drag them to their proper place in my messy map. Dragging notes out of a container in map view is a PITA. Any advice for a way to achieve this without targeting the adornment through applescript?

I’m not sure I follow you. (It might be clearer if we talked about the actual task, or something like it.)

  1. You’ve made a note in map view — let’s suppose you double-clicked at {10,5}. The container’s OnAdd action sets some preliminary values.

  2. You drag the note onto the adornment “Fancy”. The adornment’s OnAdd action now changes the note’s appearance and prototype.

  3. Finally, you drag the note where it belong in the map.

This is a perfectly good workflow, though these days many people would use a Stamp’s action instead of the adornment.

There’s seldom a reason to use AppleScript in Tinderbox to act on Tinderbox.

OK, I should have clarified: the notes are funneled into Tinderbox from outside the app. They’re selected notes written in Emacs and part of a large repository of my notes. The goal is to send them to Tinderbox and have them arrive in a predicable place, be treated in certain automatic ways, and then be ready for me to drag them where I want them on the map. So, I use AppleScript as the glue/channel between Emacs and Tinderbox.

Aha.

  1. You can get the Xpos and Ypos of the adornment Fancy easily enough.
  2. Set the Xpos and Ypos of NewNote to that value. Or, better, add a bit of random number so the notes don’t have exactly the same location.
  3. Later, come and pick up the notes in Fancy and put them where they belong.

Thanks! I’ll play with that.