I tested the Luther's script.
(1) On my machine running 10.6.6 in French, I was forced to edit two lines this way:
set prefsFolder to (path to preferences folder from user domain) as text tell application "Finder" to set prefsFile to (file "com.apple.Safari.plist" of folder prefsFolder) as alias
(2) it changes the value in the preferences file but it doesn't pass the value to the running app. Nigel's one does quite the same job but, as it quits Safari, then restart it, the app take benefit of the change but it seems that quitting isn't an option for Tommy.
I wish to add that in the script which I posted, many instructions are embedded for educational purposes : they allow us, during the process of creation, to get the required infos about the UI elements available in the target window and sheets.
They are ruled by the flag "workInProgress" but it may be more efficient to remove them or to comment them out.
GUIScripting is often ugly but sometimes, there is no alternative. And of course it's in such cases the changes in the operating system strike.
I have some of these scripts triggering dialogs whose behavior change which every major OS upgrade. At this time, I'm a bit anxious of what the engineers will introduce in Lion to require a new code.
Yvan KOENIG (VALLAURIS, France) dimanche 13 mars 2011 22:22:32
|