Saving dialog data in script bundle query...

Hi All,

Please can someone point me in the right direction.

I’ve written a script that automates a process in InDesign. When executed the script asks the user to enter certain processing parameters into multiple fields in a dialog box. The fields in question have default values.

If the user changes the default parameters I’d like to save those to a file in the script bundle so they go with the app if transferred to a different mac.

I’ve thought of one or two ways to do this however before I start I though i’d ask what is the safest way to do this is?

Thanks in advance,

Nick

Hi,

I recommend the good old load / store script way


-- preferences script object

script indesignUserPreferences
	property userBooleanPreference : false
	property userStringPreference : ""
end script

-- load preferences

set preferencesPath to (path to me as text) & "Contents:Resources:indesignUserPreferences.scpt"
try -- for first run
	set indesignUserPreferences to load script file preferencesPath
end try
set theBoolean to indesignUserPreferences's userBooleanPreference
set theString to indesignUserPreferences's userStringPreference

-- store preferences

set indesignUserPreferences's userBooleanPreference to true
set indesignUserPreferences's userStringPreference to "newString"
store script indesignUserPreferences in file preferencesPath


Thanks for the help, and code, Stefan.

Cheers! :slight_smile: