A little pesky bug in SD 7

Just started up SD 7 for the first time, going thru the Prefs, and noticing that I can specify macros (called “expansion tags” for the Copyright notice.

So I change it a little, e.g. into “Written [[date]] by [[name]]” and being put off by the fact that it inserts a U.S. formatted date even though my System settings are set to German format. Just before wanting to fiile a bug about this, I wonder: What other macros can I use? So I click the little “?” button to open the help and find out that there are, indeed, macros that use the system settings, such as “short-date” and “long-date” (point: I am missing a macro that uses the “abbreviated” format).

So I think: Good, no need to file a report.

And then I see that there is also a “copyright” macro. And so my devious little brain starts wondering: What happens when I enter that there?

Making sure I have no unsaved changes, I bravely finish entering “Written [[date]] by [[name]] [[copyright]]” … poof! :smiley:

And SD was so “smart” to save every change to any control immediately, so when I restart SD, it crashes again right away (may I suggest to save changes only when a text field loses focus instead of saving whenever its content changes?)

Fortunately, having the app “Prefs Editor” at hand, it was easy to find the bad setting and correct it.

I just love breaking, uh testing, new software! ;-D

Thomas, it’s not clear where you entered that text, which is perfectly valid. And can you elaborate on poof!?

FYI, [[copyright]] should enter what you set for the Copyright Template in Preferences -> General. The default is Copyright © [[year]] [[user]], All Rights Reserved.

Yep, it’s the one titled “Copyright Template”. Why don’t you try to enter [[copyright]] there yourself and see how it goes poof :slight_smile: (hint: recursion)

And yes, I know it’s not a serious issue, as there’s no use to enter such nonsense. But it’s a funny bug, IMO, that’s why I brought it up here.

OK, now I understand what you are saying.

You can, but as I’m sure you know preference panes are generally built around the the user defaults system and bindings. The idea here is to display the expanded tags below the field “live” as the user types them, hence the continuous updating.

Can you explain what “poof” means? I’m not sure my experience is the same as yours.

As soon as I entered “[[copyright]]” in that field and closed the preference window SD crashed.

Apparently you’re seeing some evidence of recursion, which I’m not seeing.

I think that is Thomas’s poof!.

Recursion is the cause. SD is trying to expand [[copyright]], which contains [[copyright]], so it goes on and on.

The short-term answer is don't do that. A fix to stop it will be forthcoming.

This might be a good place to mention the new *library directives. So something like this:


Will add a simple use statement for the library, but only if there isn’t one already. And the fuller version:


Will add (or modify) a full use statement with variable and version.

So a clipping like this:

[[*library:SomeLib:1.0:Some Lib]]
set x to [[template:SomeLib]]'s doIt([[template:theValue]])

Will insert this below other use statements:

use SomeLib : script "Some Lib" version "1.0"

and this where the insertion point was:

set x to SomeLib's doIt(theValue)

with SomeLib and theValue as tokens in the later.

The details on what happens when there are clashes with an existing use statement are covered in the Help file.

1 Like

I think that belongs in its own thread!

Are there placeholders or directives for:

use AppleScript version "2.4"
use scripting additions

No – they’re in the standard templates already.