I’ve written an application which processes images using the colorsync extension. It contains ‘path to’ references to various folders such as the desktop, preferences and colorsync profiles. I’ve worked out that I need to recompile the script on each mac I install it on to update these paths to the local machine. Is there any way I can avoid this and make installation drag and drop?
If you use, eg, “path to system folder”, it should return the path to the system folder of every machine, so you can manipulate such path as you need. Eg:
set systemFolder to (path to system folder)
set folderISearchFor to "" & systemFolder & "common babe:profiles:" as alias
If you know all computers you are working have the folder “profiles” within the folder “common babe” within the system folder, this will work for every machine…
Are the references stored as properties?
– Rob
They are stored as properties. For example, this one defines the location of the application’s preferences file;
property pref_path : (path to preferences as text) & “ColorSync Convertor ƒ:” & “ColorSyncConvPrefs”
If the script simply sets the variables (eliminating the properties), you won’t be forced to recompile the scripts on the host computers.
set pref_path to (path to preferences as text) & "ColorSync Convertor ƒ:" & "ColorSyncConvPrefs"
If you really want to use properties for whatever reason, you could do this:
property pref_path : ""
if pref_path is "" then
set pref_path to (path to preferences as text) & "ColorSync Convertor ƒ:" & "ColorSyncConvPrefs"
end if
The second example will store the local reference as a property on the first run and/or after a recompile. This ‘might’ result in a speed increase on subsequent runs, although I doubt that it would be detectable or advantageous.
– Rob
Thanks very much for your help. Much appreciated. I’ll try out your suggestions.