Esiste un modo per salvare le preferenze di Mac OS X in un file shell?


17

Ogni volta che reinstallo il mio Mac OS e / o acquisto un nuovo Mac, devo configurare manualmente quasi tutte le opzioni di mouse, dock, ecc.

Vorrei sapere se Mac OS o alcuni software possono fornire un modo per salvare tutte le configurazioni che ho impostato con l'app Preferenze di Sistema in un file shell, creando qualcosa come https://github.com/mathiasbynens/ di Mathias Bynens dotfile / blob / Master / .macos

Risposte:


11

Le Preferenze di Sistema sembrano essere memorizzate in vari luoghi, a seconda che siano specifiche dell'utente o del sistema. Molti di questi sono memorizzati in uno /Library/Preferences/o $HOME/Library/Preferences/(per le impostazioni per utente). Ma ogni riquadro delle preferenze avrà il suo modo di memorizzarle.

Puoi vedere quali preferenze sono memorizzate in questo modo digitando:

defaults read <domain>

Dove si <domain>trova l'inizio del nome file nelle preferenze di sistema per utente o il percorso completo di un .plistfile. Per esempio:

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

Il primo mostrerà la personalizzazione per utente delle impostazioni del salvaschermo, mentre il secondo mostrerà le impostazioni del salvaschermo di sistema.

Le impostazioni sono in gran parte organizzate in base al riquadro delle preferenze, anche se non necessariamente così semplice. Probabilmente dovrai cercare in /Library/Preferencese sottocartelle (specialmente SystemConfiguration) per trovarle tutte.

Un'opzione sarebbe quella di copiare i file pertinenti e rimetterli a posto per le nuove installazioni.

Un altro modo sarebbe quello di esportarlo e importarlo come richiesto.

Esportazione delle preferenze di sistema di Risparmio energia (Risparmio energia) su pm.plist:

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

Importazione di tali preferenze dal pm.plistnuovo computer:

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

Potresti anche voler modificare i vari .plistfile esportati se ci sono preferenze di sistema specifiche che vuoi / non vuoi condividere tra computer. In questo modo puoi avere alcune personalizzazioni localmente e il importcomando non le sovrascriverà, aggiungi solo quelle che hai impostato nei .plistfile. Puoi usare anche il defaultscomando per modificare i tuoi .plistfile (ma assicurati di specificare il percorso completo del file, non solo un nome, oppure potresti modificare le tue preferenze per utente).


1
"com.apple.systempreferences" in realtà non contiene alcuna preferenza per il sistema. Contiene le preferenze per l'applicazione Preferenze di Sistema. Pertanto, nessuna delle configurazioni effettive eseguite con le Preferenze di Sistema sono memorizzate in questo file.
Tony Williams,

@TonyWilliams, hai ragione, lo risolverà ...
drfrogsplat,

9

La produzione automatica di uno script per apportare tutte le modifiche necessarie è quasi impossibile. Gli amministratori di sistema Mac trascorrono molte ore in bar scuri bevendo birra o bourbon e scambiando parti di questi file: siamo riluttanti a condividere tutto ciò che funziona a meno che non siate pronti a raccogliere la scheda.

In realtà il modo più semplice per acquisire le modifiche alla configurazione è usare lo snapshot.

Prendi una copia di InstallEase e crea un'istantanea del tuo nuovo Mac. Ora esegui tutta la configurazione che desideri e puoi fare un'altra istantanea e creare un programma di installazione che installerà i file modificati in un nuovo Mac.

Naturalmente possono sorgere complicazioni quando si applicano le modifiche a una nuova versione del sistema operativo, ma è per questo che beviamo il bourbon.


Esiste almeno un elenco con le opzioni per il comando "defaults write"?
Enrico P. Varella,

No. Il comando defaults può scrivere su qualsiasi file delle preferenze nel sistema, quindi è impossibile fornire un elenco completo.
Tony Williams,

Questa è un'idea intelligente.
Danijel-James W,

1
InstallEase sembra non essere più disponibile
Sebastian

Casper ha uno strumento di snapshot che puoi usare al posto di InstallEase.
Tony Williams,

6

L'ultima volta che ho eseguito una reinstallazione pulita ho appena copiato l'intera ~/Library/Preferences/cartella e non ho riscontrato alcun problema a causa sua. Le impostazioni per le vecchie versioni delle applicazioni e le impostazioni specifiche per Mac dovrebbero essere semplicemente ignorate. Non ci sono quasi file in ~/Library/Preferences/una nuova installazione e se si eliminano tutti i file ~/Library/Preferences/, i file delle preferenze verranno ricreati quando sono necessari.

I file delle preferenze per le applicazioni sandbox sono ora archiviati ~/Library/Containers/, ma non so se copiarlo su un altro Mac causerebbe problemi.

Potresti anche usare Migration Assistant .

Oppure, se segui il .osxpercorso, puoi diff l'output di defaults read:

  1. Correre defaults read|awk 'length<200'>/tmp/a
  2. Modifica alcune impostazioni
  3. Correre defaults read|awk 'length<200'>/tmp/b;diff /tmp/[ab]

È possibile eseguire sudo opensnoopo utilizzare fseventer per vedere quali file vengono modificati quando si cambiano le preferenze dalla GUI.


3

Dopo molte ore alla ricerca di qualcosa di almeno utile per il mio problema, ho trovato un sito web chiamato Secrets , che fornisce molti comandi comuni di "default write" di Mac OS.

Comunque, ringrazio Tony e drfrogsplatless per avermi dato chiarimenti e suggerimenti che mi sono stati utili.

(modifica: sito offline, usando la versione archiviata)


web.archive.org/web/20150322005829/http://secrets.blacktree.com ? ha una copia di archivio di settembre 2015.
ecmanaut,

1

Mackup è quello che stai cercando. https://github.com/lra/mackup/tree/master/doc


Mackup sembra uno strumento fantastico ma non supporta la scrittura predefinita. Anche questo lo spiega meglio del link che hai fornito: github.com/lra/mackup
ClintM

1

Ecco uno script Apple parzialmente completato che ho scritto nell'agosto 2016 per il mio Mac, pubblicato qui come "prova del concetto" è un po 'forte, ma è qualcosa con cui puoi giocare:

(* Prima di eseguire questo script è necessario innanzitutto concedere i collant Apple Script in Preferenze di Sistema -> Sicurezza e privacy -> Accessibilità e consentire a Apple Script di controllare il computer. È possibile ottenere un vantaggio eseguendo lo script fino a quando non fallisce Quindi fermare lo script, passare alla finestra di dialogo Preferenze e selezionare la casella accanto a Script Editor. Quindi è possibile tornare indietro, eliminare tutti gli screenshot già acquisiti (per evitare confusione nei duplicati) e riavviare lo script.

Perché hai bisogno di farlo? Alcuni dialoghi preferenziali, una volta aperti e "fotografati", devono essere esplicitamente chiusi con un clic del mouse sul pulsante Annulla. Apple Script non può farlo a meno che non disponga dei diritti "per controllare il computer" all'interno di tale pref. *)

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
Utilizzando il nostro sito, riconosci di aver letto e compreso le nostre Informativa sui cookie e Informativa sulla privacy.
Licensed under cc by-sa 3.0 with attribution required.