Message: 1
Date: Thu, 4 Feb 2010 13:56:58 -0500
From: Chris Devers <
email@hidden>
Subject: Using Automator to assert Finder preferences?
To:
email@hiddenI've looked through the archives, but don't see anything along these
lines. If this is FAQ material or has already been discussed
elsewhere, please let me know.
I'm trying to come up with an automated way to make two changes to user's Macs:
* turn off icon previews for the Desktop and all 4 Finder display views
* add mounted network drives to the Finder sidebar, the way Tiger & Panther did
Both of these are, of course, simple to do from the GUI. For the
former, just hit cmd+J to bring up view options, then uncheck the
boxes as needed; for the latter, just drag the drive icons to the
sidebar.
The problem is that I'm having trouble coming up with a good automated
way to do this for masses of computers. I could just distribute a
common .plist file for people, but I don't want to clobber any of
their other settings, just these two, so that's overkill.
For other things, I can use a `defaults write ...` command to change
the option, but because of the way these are both set within nested
data structures in the .plist file, the syntax for that starts getting
complicated and, worse, brittle. I could also use PlistBuddy, which is
a bit more adept at handling complex .plist structures, but it still
seems like a pain for this problem.
Then I realized that Automator can record me making these changes, and
save the result as a runnable application that appears to work, at
least for the icon previews problem -- haven't tried it for the
volumes-in-sidebar one yet.
The downside though is that every time you run it, it just toggles the
state from whatever it was last set to, rather than affirmatively
asserting that the box needs to be unchecked only if it was previously
checked, and I can't seem to figure out how to insert that kind of
logic into the Automator workflow. (Maybe I could call a shell script
that does a diff on "before" and "after" versions of the .plist, and
reverts back to the original if it was already set properly?)
I also tried AppleScript Editor, but this doesn't even record the UI
actions in enough detail, just "open Finder, open window, close
window". No help there.
So, The Question:
What is the usual method, if any, for using Automator (or AppleScript)
to change a preference file setting if & only if it wasn't already the
way you need it to be set?
Thank you.
--
Chris Devers