I have a few scripts which for some reason no longer save their values into the property variables when the script finishes.
I started noticing this with Yosemite I believe, but continue seeing it on El Capitan.
I first thought it was only something with my machine, as others I distribute the script to did not seem to have the issue. I migrated one user on El Capitan to see if it was related to the OS version, and his did save the value, so that made me think it was isolated to my machine. However, we recently purchased a new Mac that has El Capitan on it, and it has started showing the same issue. So I now have the same script used across 20-ish macs on 10.9 that do not have the issue, one mac on 10.11 that does not have the issue, and two macs with 10.11 that do have the issue.
If I tried to write a simple script from scratch to create a property, then write to it and end, it does not seem to be an issue.
I took one of the scripts with the issue and kept whittling it down to less code to see if I could get it down to a point where it would start working correctly again. I took the original script, opened a new document in Script Debugger and pasted in the code into the new document (in case it was something in the original app package), and then started deleting lines. I got about as far as I could go, down to:
property previousTesters : {"one"}
on run
my publishBeta()
end run
on publishBeta()
set allTesters to {"one", "two", "three"}
set betaChoice to (choose from list allTesters default items previousTesters with prompt "Choose One" with title "Choose One" with multiple selections allowed)
set previousTesters to betaChoice
end publishBeta
If I run this code in an open Script Debugger window, it works fine. However, when I save it as an application and run it, it does not keep the variable set within the script, and the list dialog will always show “one”.
If I take it to the El Capitan machine that is not seeing the issue, it works fine as an application.
Further confusing, if I hand type this entire code into a new document in Script Debugger, and save it as an application, THEN it does work fine as an application.
What could possibly be going on that the same code (one pasted into a new document and one hand typed into a new document) is working two different ways?