Mac OS Xの設定をシェルファイルに保存する方法はありますか?


17

Mac OSを再インストールしたり、新しいMacを購入したりするたびに、マウスやドックなどのほとんどすべてのオプションを手動で構成する必要があります。

Mac OSまたはいくつかのソフトウェアが、システム環境設定アプリで設定したすべての構成をシェルファイルに保存して、Mathias Bynensのようなhttps://github.com/mathiasbynens/のようなものを作成する方法を提供できるかどうか知りたいdotfiles / blob / master / .macos

回答:


11

システム環境設定は、ユーザー固有かシステム固有かによって、さまざまな場所に格納されているように見えます。それらの多くは、/Library/Preferences/または$HOME/Library/Preferences/(ユーザーごとの設定の場合)に保存されます。ただし、各設定ペインには、それぞれの保存方法があります。

次のように入力すると、どの設定がこの方法で保存されているかを確認できます。

defaults read <domain>

どこに<domain>あなたのユーザごとのシステム環境設定で、ファイル名の先頭、またはへの完全なパスのいずれかである.plistファイル。例えば:

defaults read com.apple.screensaver
defaults read /Library/Preferences/com.apple.screensaver

前者はスクリーンセーバー設定のユーザーごとのカスタマイズを示し、後者はシステムのスクリーンセーバー設定を示します。

設定は、基本的には設定ウィンドウごとに整理されていますが、必ずしも単純ではありません。それらすべてを見つけるには、/Library/Preferencesサブフォルダ(特にSystemConfiguration)をさっと見回す必要があります。

1つのオプションは、関連ファイルをコピーして、新しいインストール用に元の場所に戻すことです。

別の方法は、必要に応じてそれをエクスポートおよびインポートすることです。

電源管理(エネルギー節約)システム設定をpm.plistにエクスポート:

defaults export /Library/Preferences/SystemConfiguration/com.apple.PowerManagement pm.plist

これらの設定をpm.plist新しいコンピューターからインポートする:

defaults import /Library/Preferences/SystemConfiguration/com.apple.PowerManagement sysprefs.plist

.plistコンピュータ間で共有したくない、または共有したくない特定のシステム設定がある場合は、エクスポートされたさまざまなファイルを編集することもできます。そうすれば、ローカルでカスタマイズを行うことができ、importコマンドはそれらを上書きせず、.plistファイルに設定したものを追加するだけです。このdefaultsコマンドを使用して、独自の.plistファイルを変更することもできます(ただし、名前だけでなく、ファイルのフルパスを指定してください。そうでない場合は、ユーザーごとの設定を変更する可能性があります)。


1
「com.apple.systempreferences」には、実際にはシステムの設定は含まれていません。システム環境設定アプリケーションの環境設定が含まれています。したがってシステム環境設定で行う実際の構成はこのファイルに保存されません。
トニーウィリアムズ

@TonyWilliams、正解です、これを修正します...
drfrogsplat 2014年

9

必要なすべての変更を行うスクリプトを自動的に作成することは、ほとんど不可能です。Macシステム管理者は、ビールやバーボンを飲み、これらのファイルの一部を交換する暗いバーで何時間も費やしています。

実際、構成の変更をキャプチャする最も簡単な方法は、スナップショットを使用することです。

InstallEaseのコピーを入手して、新しいMacのスナップショットを作成します。次に、必要なすべての構成を行い、別のスナップショットを取得して、変更されたファイルを新しいMacにインストールするインストーラーをビルドします。

もちろん、変更をオペレーティングシステムの新しいバージョンに適用するときに複雑さが発生する可能性がありますが、それがバーボンを飲む理由です。


「defaults write」コマンドのオプションを含むリストは少なくともありますか?
Enrico P. Varella 2014年

いいえ。defaultsコマンドはシステム内の任意の設定ファイルに書き込むことができるため、完全なリストを提供することは不可能です。
トニーウィリアムズ

これは賢いアイデアです。
Danijel-James W

1
InstallEaseはもう利用できないようです
Sebastian

Casperには、InstallEaseの代わりに使用できるスナップショットツールがあります。
トニーウィリアムズ

6

最後にクリーン再インストールを行ったとき、~/Library/Preferences/フォルダ全体をコピーしただけで、そのため問題は発生しませんでした。古いバージョンのアプリケーションの設定とMac固有の設定は無視してください。~/Library/Preferences/新規インストールではファイルはほとんどありません。ですべてのファイルを削除すると~/Library/Preferences/、必要なときに設定ファイルが再作成されます。

サンドボックスアプリケーションの設定ファイルは現在に保存されていますが~/Library/Containers/、別のMacにコピーすると問題が発生するかどうかはわかりません。

移行アシスタントを使用することもできます。

または、.osxルートに移動した場合、次の出力を比較できますdefaults read

  1. 走る defaults read|awk 'length<200'>/tmp/a
  2. 一部の設定を変更する
  3. 走る defaults read|awk 'length<200'>/tmp/b;diff /tmp/[ab]

fseventerを実行sudo opensnoopまたは使用して、GUIから設定を変更したときに変更されるファイルを確認できます。


3

私の問題に少なくとも役立つものを何時間も探した後、私はSecretsというWebサイトを見つけました。このWebサイトには、一般的なMac OSの「デフォルトの書き込み」コマンドが多数提供されています。

とにかく、私に役立つ説明とヒントをくれたTonyとdrfrogsplatlessに感謝します。

(編集:オフライン版、アーカイブ版を使用)



1

Mackupはあなたが探しているものです。https://github.com/lra/mackup/tree/master/doc


Mackupは素晴らしいツールのように見えますが、デフォルトの書き込みをサポートしていません。また、これはあなたが提供したリンクよりもよく説明しています:github.com/lra/mackup
ClintM

1

2016年8月にMac向けに書いた、部分的に完成したApple Scriptを以下に示します。「概念実証」はやや強力ですが、試してみることができます。

(*このスクリプトを実行する前に、まず[システム環境設定]-> [セキュリティとプライバシー]-> [アクセシビリティ]でApple Scriptタイツを許可し、Apple Scriptがコンピューターを制御できるようにする必要があります。スクリプトが失敗するまでスクリプトを実行することで、すぐに始めることができます。次に、スクリプトを停止し、その[設定]ダイアログに移動して、[スクリプトエディター]の横にあるボックスをオンにします。その後、戻って、既に取ったスクリーンショットをすべて削除し(重複を混乱させないようにするため)、スクリプトを再度開始します。

なぜこれを行う必要があるのですか?一部の優先ダイアログは、いったん開いて「撮影」したら、[キャンセル]ボタンをマウスでクリックして明示的に閉じる必要があるためです。Apple Scriptは、その設定内で「コンピュータを制御する」権限がない限り、それを行うことはできません。*)

tell application "System Preferences" to quit
delay 0.25

-- MAKE THE PREFS PICS FOLDER ON THE DESKTOP IF IT ISN'T THERE ALREADY.
-- IF IT IS THERE ALREADY, NO CHECKING IS DONE WITH REFERENCE TO WHATEVER FILES ARE IN IT.
tell application "Finder"
    if not (exists folder "Prefs Pics" of desktop) then
        make new folder with properties {name:"Prefs Pics", location:"desktop"}
    end if
end tell

tell application "System Preferences"
    activate

-- THE PREFS ARE ORDERED BELOW ALPHABETICALLY. TO HAVE THEM SAVE THAT WAY, REMOVE THE ORDER ID (oid) VARIABLE FROM THE CODE LINE SETTING EACH FILENAME. OTHERWISE THE FILENAME WILL BE SET BASED ON THE GROUP AND ICON NUMBERS (ROW AND COLUMN) AS DISPLAYED WHEN SYSTEM PREFS ARE ARRANGED BY CATEGORY.
-- GROUP 4 NO 3 APP STORE
set oid to 43
set current pane to pane "com.apple.preferences.appstore"
-- Now that the first pref window is up, get its name and assign it to a variable
set nid to (get name of first window whose visible is true)
-- Do the same for its ID
set wid to (get id of first window whose visible is true)
-- Now wait one second and capture the window, passing the wid varialble to screencapture's -l switch and the nid variable to the filename to be used, and save the file
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"
-- note you can't be messing around with the computer until the script ends; otherwise you'll interfere and prolly capture wrong winders

-- GROUP 4 NO 7 TIME MACHINE
set oid to 47
set current pane to pane "com.apple.prefs.backup"
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

-- GROUP 3 NO 5 BLUETOOTH
set oid to 35
set current pane to pane "com.apple.preferences.Bluetooth"
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

-- GROUP 4 NO 5 DATE & TIME
set oid to 45
set current pane to pane "com.apple.preference.datetime"
reveal anchor "DateTimePref" of current pane
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

reveal anchor "TimeZonePref" of current pane
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

reveal anchor "ClockPref" of current pane
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

-- GROUP 1 NO 2 DESKTOP & SCREEN SAVER                                              -- NEEDS TROUBLESHOOTING TO SELECT LEFT PANE IN DESKTOP TAB
set oid to 12
set current pane to pane "com.apple.preference.desktopscreeneffect"
-- reveal anchor "DesktopPref" of current pane
-- set nid to (get name of first window whose visible is true)
-- set wid to (get id of first window whose visible is true)
-- do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

reveal anchor "ScreenSaverPref" of current pane
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

-- GROUP 2 NO 1 DISPLAYS
set oid to 21
set current pane to pane "com.apple.preference.displays"
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"
-- reveal anchor "displaysArrangementTab" of current pane                   -- NEEDS TROUBLESHOOTING
-- reveal anchor "displaysColorTab" of current pane                         -- NEEDS TROUBLESHOOTING
-- reveal anchor "displaysGeometryTab" of current pane                      -- NEEDS TROUBLESHOOTING
-- reveal anchor "displaysDisplayTab"                                               -- NEEDS TROUBLESHOOTING

-- GROUP 1 NO 3 DOCK
set oid to 13
set current pane to pane "com.apple.preference.dock"
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

-- GROUP 2 NO 2 ENERGY SAVER
set oid to 22
set current pane to pane "com.apple.preference.energysaver"
--  reveal anchor "Schedule" of current pane                                        -- NEEDS TO BE CLOSED BEFORE MOVING ON

-- GROUP 1 NO 4 MISSION CONTROL
set oid to 14
set current pane to pane "com.apple.preference.expose"
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

-- GROUP 3 NO 3 EXTENSIONS
set oid to 33
set current pane to pane "com.apple.preferences.extensions"
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

-- GROUP 1 NO 1 GENERAL
set oid to 11
set current pane to pane "com.apple.preference.general"
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

-- GROUP 3 NO 1 ICLOUD  
-- set oid to 31
-- set current pane to pane "com.apple.preferences.icloud"                  -- THIS PREFERENCE WAS NOT COPIED

-- GROUP 3 NO 2 INTERNET ACCOUNTS
-- set oid to 32
-- set current pane to pane "com.apple.preferences.internetaccounts"        -- THIS PREFERENCE WAS NOT COPIED

-- GROUP 2 NO 3 KEYBOARD
set oid to 23
set current pane to pane "com.apple.preference.keyboard" -- NEEDS TROUBLESHOOTING
reveal anchor "keyboardTab" of current pane
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

reveal anchor "Text" of current pane
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

reveal anchor "shortcutsTab" of current pane
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

reveal anchor "InputSources" of current pane
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

reveal anchor "keyboardTab_ModifierKeys" of current pane
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

tell application "System Events" to tell process "System Preferences"
    click button "Cancel" of sheet 1 of window "Keyboard"
end tell

-- GROUP 1 NO 5 LANGUAGE & REGTION
set oid to 15
set current pane to pane "com.apple.Localization"
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

reveal anchor "Region" of current pane
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

reveal anchor "Language" of current pane
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

-- GROUP 2 NO 4 MOUSE
set oid to 14
set current pane to pane "com.apple.preference.mouse"
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

-- GROUP 3 NO 4 NETWORK
--  set oid to 34
--  set current pane to pane "com.apple.preference.network"

-- GROUP 1 NO 8 NOTIFICATIONS
-- set oid to 18
-- set current pane to pane "com.apple.preference.notifications"

-- GROUP 4 NO 2 PARENTAL CONTROLS
-- set oid to 42
--  set current pane to pane "com.apple.preferences.parentalcontrols"

-- GROUP 2 NO 6 PRINTERS & SCANNERS
--  set oid to 26   
--  set current pane to pane "com.apple.preference.printfax"
-- reveal anchor "fax" of current pane
--  reveal anchor "share" of current pane
--  reveal anchor "print" of current pane
-- reveal anchor "scan" of current pane

-- GROUP 1 NO 6 SECURITY & PRIVACY
set oid to 16
set current pane to pane "com.apple.preference.security"
reveal anchor "General" of current pane
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

reveal anchor "FDE" of current pane
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

reveal anchor "Firewall" of current pane
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

reveal anchor "Privacy" of current pane
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

reveal anchor "Privacy_LocationServices" of current pane
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

reveal anchor "Privacy_Contacts" of current pane
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

reveal anchor "Privacy_Calendars" of current pane
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

reveal anchor "Privacy_Reminders" of current pane
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

reveal anchor "Privacy_Facebook" of current pane
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

reveal anchor "Privacy_Accessibility" of current pane
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

reveal anchor "Privacy_Diagnostics" of current pane
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"
--  reveal anchor "Privacy_Twitter" of current pane
--  reveal anchor "Privacy_Weibo" of current pane
--  reveal anchor "Privacy_TencentWeibo"
--  reveal anchor "Privacy_Assistive" of current pane
--  reveal anchor "Privacy_LinkedIn" of current pane
--  reveal anchor "Advanced" of current pane

-- GROUP 3 NO 6 SHARING
set oid to 36
set current pane to pane "com.apple.preferences.sharing"
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

-- GROUP 2 NO 7 SOUND
set oid to 27
set current pane to pane "com.apple.preference.sound"
reveal anchor "effects" of current pane
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

reveal anchor "output" of current pane
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

reveal anchor "input" of current pane
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

-- GROUP 4 NO 4 DICTATION & SPEECH
set oid to 44
set current pane to pane "com.apple.preference.speech"
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

reveal anchor "TTS" of current pane
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

reveal anchor "Dictation" of current pane
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

-- GROUP 1 NO 7 SPOTLIGHT
set oid to 17
set current pane to pane "com.apple.preference.spotlight"
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

reveal anchor "privacy" of current pane
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

reveal anchor "searchResults" of current pane
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

-- GROUP 4 NO 6 STARTUP DISK
set oid to 46
set current pane to pane "com.apple.preference.startupdisk"
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

-- GROUP 2 NO 5 TRACKPAD
set oid to 25
set current pane to pane "com.apple.preference.trackpad"
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

-- GROUP 4 NO 1 USERS & GROUPS
set oid to 41
set current pane to pane "com.apple.preferences.users"
reveal anchor "passwordPref" of current pane
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

reveal anchor "startupItemsPref" of current pane
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

reveal anchor "loginOptionsPref" of current pane
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

--  reveal anchor "mobilityPref" of current pane
--  set nid to (get name of first window whose visible is true)
--  set wid to (get id of first window whose visible is true)
--  do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

-- GROUP 4 NO 8 ACCESSIBILITY
set oid to 48
set current pane to pane "com.apple.preference.universalaccess"
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

reveal anchor "Seeing_VoiceOver" of current pane
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

reveal anchor "Switch" of current pane
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

reveal anchor "Keyboard" of current pane
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

reveal anchor "Seeing_Display" of current pane
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

reveal anchor "Hearing" of current pane
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

reveal anchor "Seeing_Zoom" of current pane
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

reveal anchor "SpeakableItems" of current pane
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

reveal anchor "Media_Descriptions" of current pane
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

reveal anchor "Mouse" of current pane
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"

reveal anchor "Captioning" of current pane
set nid to (get name of first window whose visible is true)
set wid to (get id of first window whose visible is true)
do shell script "screencapture -T1 -l" & wid & " ~/Desktop/Prefs\\ Pics/" & oid & "\\ " & quoted form of (nid) & "\\ " & "$(date +%Y-%m-%d-%H%M%S).png"
end tell
tell application "System Preferences" to quit


-- HELPERS FOR THE HOMEWORK THAT NEEDED TO BE DONE BEFORE THE SCRIPT COULD BE WROTEN
-- GET ALL PANE ID'S
-- tell application "System Events"
-- tell application "System Preferences"
-- get the id of every pane
-- end tell
-- end tell


-- GET ALL PANE NAMES
-- tell application "System Preferences"
-- name of panes
-- end tell


-- GET THE ANCHOR NAME FOR A PARTICULAR PANE
-- tell application "System Preferences"
-- activate
-- get the name of every anchor of pane id "com.apple.preferences.users"
-- end tell
弊社のサイトを使用することにより、あなたは弊社のクッキーポリシーおよびプライバシーポリシーを読み、理解したものとみなされます。
Licensed under cc by-sa 3.0 with attribution required.