I am very familiar with Studio’s User Defaults which is perfect for storing text, unicode text or anything that can be type cast as such, e.g., a boolean. But this time, I need to store an array of objects. So, I store this array in a script file …
… the saved script file looks like:
property theFiles : {}
… when I start up, I use
on loadFilesScript()
try
set filesScriptRef to choose file default location alias (path to me as string) ¬
with prompt "Locate your 'allFiles.scpt'" of type {"osas"} without invisibles
-- property theFiles : null -- allFiles.scpt
set filesScriptObj to load script filesScriptRef
set filesScriptLoaded to true
on error errMsg number errNum
if errNum = -128 then tell me to display dialog "User cancelled .. application will now quit"
quit
end try
end loadFilesScript
… and every time I change this object array, I use
set theFiles of filesScriptObj to newFiles
store script filesScriptObj in filesScriptRef replacing yes
… but, when I open the saved script file in Script Editor, it looks the same, i.e, count theFiles = 0
… maybe I need to implement one of the methods suggested by Adam Bell, hhas, Bruce Phillips ???
Any help is definitely appreciated.