AppleScript Property Mojave

I updated my system from El Capitan to Mojave 1 or 2 weeks ago.
Note : I’m really happy to see the DarkMode I activated on my applications developed with Xojo are quiet well (users sent me 1 or 2 screencaptures).

I have some AppleScript with property. I export my script in Application, only executable. The Variables are not memorised from one launch to the other (they were memorised under El Capitan).
My source name is (example) : MyScriptBla v1.01.scpt , and I save it (Application, only executable) MyScriptBla.app and in this case property variables don’t work.
If I save my app, keeping the name MyScriptBla v1.01.app then the property variables are memorised.
Strange no ?

After all I read in this forum about Mojave and Catalina: NO !.

a. Are-you sure AppleScript is still the way to go (for now in 2019 and the future) ?
(AppleScript still semms to be supported by Apple in its OS, but who knows what the future [tomorrow] will be ?)

b. You can save the Properties values from Xojo in a text or binary (depends on what you need / have to save) without the AppleScript help in a disk file.

Nota: I do not understand why you need AppleScript and how the variable did not change (nor reset).
The answer above is trying to help.

Did you try NSAppleScriptMBS class?
We have examples using properties.

Thank you for yours answers. I make some little script for my personal use, I do not develop in AppleScript, I program with Xojo.
But I have 20 small AppleScript which help me every day, I hope I will be able to continue to use them.

I wrote my question in Off-Topic because, if I sometimes use AppleScript in Xojo, it’s not the case here.
I made somme Applescript which I save as application executable only, and I launch same by a double-click in the Finder.
After some tests, I saw the following things :

  • If I put my Script in Security-Accessibility, I’m not asked everytime I launch the script to allow the script to … . But my property are not saved.
  • If I don’t put it there, I’m ask each time to allow the script to … but my property are saved.

I don’t understand why.

You need Automation and not Accessibility.

They are in Automation.

Copy this AppleScript code :

property MyDate : current date

on run
	tell application "Finder"
		activate
		set NewDate to current date
		set PathToMe to path to me
		reveal PathToMe
		display dialog (PathToMe as text) & return & "Last launch: " & (MyDate as text) & return & "Current:        " & (NewDate as text)
		set MyDate to NewDate
	end tell -- "Finder"
end run

Export it as Application / only executable.

Launch it without doing anything else. Finder will ask authorisation but property MyDate will be saved.

Put the application script in Accessibility , the property won’t be saved.

Is it a Mac Os X bug or do I do something wrong? I would like my property be saved without having Finder asking for authorisation each time I launch the ApplicationScript.

It’s not a bug, it’s a feature. A feature that serves no vital purpose and breaks literally millions of AppleScripts (including many of mine), but Apple tends to “think different” about features. The only workaround I’m aware of is somewhat complicated — there’s a discussion here: https://apple.stackexchange.com/questions/356128/how-do-i-retain-globals-in-applescript-between-invocations-under-mojave

Thank you, I read the link quickly and read it again later. As far as I understand, Property are saved inside the package of the ApplicationScript, that’s why it ask authorisation again because it’s the same as if we just download an update.