Applescript Directives in clippings

Picking up from another thread…

In a clipping, this text:
[[*library::1.0.7:Myriad Tables Lib]]

places this at the top of the script:


use script "Myriad Tables Lib" version "1.0.7"

Shouldn’t the comment come after the use script statement?

Also, there are a few blank lines above the comment/use script statement. Shouldn’t those be right at the top (below any other use statements)?

Not necessarily. It should come wherever the selection is at the time of inserting the clipping.

OK, shouldn’t the use statement go at the top of the script?

Also I noticed that if you have a commented out directive the comment gets ignored and the directive is used.

–[[*library::1.0.7:Myriad Tables Lib]]

It depends how you define top. In this case it’s defined as before the first line that’s not either blank or a comment. Scripts typically include several lines of comment at the top, and it wouldn’t be very user friendly to put use statements before them. I think you’ll find it works OK in real-world situations.

That’s a bug.

I take that back — all tags/directives are meant to work anywhere. GIGO.