Self-installing a utility

I have created a note-package (“Utility”). It is stand-alone and the user interface consist of two stamps, the rest of the Utility can be considered “hidden”.

My aim is to create a method where a user can copy and paste (not drag) this Utility into a new or to an existing Tinderbox document and then self-install.

The only way I have found is to ask the user to create a Stamp with an action, then activating the Stamp and from there on the Utility will self-install properly.

Is there a way that the Utility package can self-install without the user doing anything (except pasting the utility container)?

1 Like

Is this a library note of function(s)? It’s not quite sure what is being added. What the user does/doesn’t ‘see’ isn’t this issue what what needs to be added where.

To my knowledge there is no app/action based method to ‘import’ external note(s).

As you note, if you copy paste the (??) resource(s) notes into a TBX you could use an action (stamp) to move the contents to the right places.

Sore for the vague answer, but beyond the absence of a notion of installable packages, it’s unclear what needs to be configured.

I’m not sure if AppleScript might be an avenue but my hunch is that’s not really the solution you are after.

If the issue is ensuring all your documents use specific non-default customisation, consider using favorites.

HTH :slight_smile:

I hope to do a meetup on this topic. Not this week. Possibly next week, for the following week.

Here’s an outline of how you might install the utility:

  1. Tell the user to add Built-In Hints to the document, if they have not already done that.
  2. Copy the note Utility Installer and paste it into your document
  3. Two new stamps will now be available in the Stamp menu…

HOW DOES THIS HAPPEN?

  1. The key to this is that edicts run when a note is selected, at startup, and occasionally during normal use. So, we can put the installation work in an edict.

  2. A second key is that our installer is going to create a new library note and move its $Text to that note. If the library note already exists, we’re already installed and we don’t need to do any work!

  3. The edict then calls a function in the newly-created library: var:boolean ok=installUtility();

  4. installUtility() then makes two new notes in /Hints/Stamps, one for each of your stamps. It then copies the code for each stamp into the stamp note. (Alternatively, it could simply move notes from inside the Utility Installer to the container /Hints/Stamps.

There are doubtless pitfalls, but I’m pretty sure it can be mad to work.

1 Like

@eastgate Is it OK to install the Utility as a Container into the Hints/Library space?
I didn’t know the edict behaviour, This is the way I’m going forward on.
As I (tried to) say in the earlier post my goal is to have a behaviour similar to a “normal” app install.

a quick sidebar. An edict differs from a rule only in how often it runs. Whilst a rule runs all the time, an edict runs:

  • on first creation (runs once)
  • on document forst opening in a session (runs once)
  • if title/text or Displayed Attributes change (not 100% sure he range of attributes in scope here)
  • otherwise, after run on /load/creation, then c. once per hour during the current session (i.e. until doc is closed) (runs once)
  • if File ▸ Update Agents Now is called all edicts update once
  • from the Edict Inspector, a specific edict can, on demand, be run once via the ‘Run now’ button.

Sure.