Exported Run Only Enhanced App storing variable content?

So I accidentally commented out a variable setting a string to a posix path which had my username in it. I didn’t replace the code… exported as run only the Enhanced App. Another user with no previous copy of the app opened it. Instead of erroring that the variable didn’t exist, it reported an error that it could not find the file at the original posix path run on my Mac when testing.

This caught me off guard. Just as I have had issues with properties for variables not going away. Is it possible the Exported Enhanced App somehow is storing properties in it? I thought it was reset when Exported.

Is this somehow related to testing/running in Script Debugger and difference of Properties in the top of the app for classes, constants, and enums using the method/style:

property NSImage : a reference to current application’s NSImage


property myApp : a reference to current application
property NSImage : a reference to myApp’s NSImage

This has been driving me nuts.

What version of Mac OS and Script Debugger are you running?

Ventura 13.1 and SD 8.0.5

Honestly the Properties call outs bewilder me in general. I saw someone else’s code only uses 1 line:

property myApp : a reference to current application

Eliminating any reference to the NSImage in the top of the code as a 3rd method using:

set my statusItemImage to myApp's NSImage's imageNamed:......
instead of
set my statusItemImage to NSImage's imageNamed:......

No. It would have lost the value as soon as you recompiled after commenting anyway.

I know you’re not going to believe me but it did not. I watched it happen over slack. There’s a small chance I only recompiled the script being called by the app and not the actual app, however I exported it as run only which I thought did the same.

I just double-checked the code. The exported script’s code is based on the compiled script of the document, so any changes that haven’t been compiled will be ignored.

So just to clarify…I have an app calling a script.scptd. The app doesn’t have any reference to a variable. I made edits to the script.scptd commented the variable out and recompiled it. I then exported the parent app without recompiling it and the script recalled the variable through the App instead of erroring the variable was undefined…In other words the App running the script stored variables. Does that make sense? I understand recompiling the App would resolve it, but want to verify your confirming.

Scripts saved or exported should not store top-level values and properties.