How to solve the errOSACantStorePointers error

I have a funky little script for BBEdit that works just fine when run from SD, but when I run it from BBEdit’s scripts menu I get the errOSACantStorePointers message when the script completes (in fact, the script does complete fine, except for the error message):

I understand this is to do with storing pointers, and I thought replacing all the

property NSString : a reference to current application's NSString

type messages at the top of the script with the long-form in-line might help, but to no avail.

Is there any way to avoid it or suppress the message?

Is this perhaps to do with initializing an NSObject before using it? Like I’m doing this at the top of a handler:

set theMutant to current application's NSMutableArray's new()

and then appending stuff to that later on.

Your properties are fine. The easiest fix is to put all your top-level code in a handler:

my doMain()

on doMain()
 -- your code
end doMain

You’re right. That was easy. :smiley:

Thx muchly.

FWIW, BBEdit should be silently trapping that error — it’s happening when the script has run and BBEdit is trying to save the updated script to disk. (I suppose you could argue that Apple should really handle it.) Anyway, bug logged with Bare Bones.

1 Like

Ah, that’s the reason! So it’s basically the same thing that you get in SD when you try to save the script but it tells you that you have to recompile it first?

Always good to know the why’s and the wherefore’s. :+1:t3: