toggle iCloud preferences from terminal or applescript

0

I'm looking for a script to toggle iCloud preferences in system preferences.

I need to automatically uncheck all the voices (Photos, Mail, Contacts, etc) leaving only iCloud Drive and Find My Mac.

In iCloud Drive settings I also need to uncheck everything, leaving only Desktop & Documents Folders

Is there a way to do so with terminal or applescript?

Thanks!

liuk

Posted 2020-01-14T11:33:35.890

Reputation: 1

Can I ask why you need to automate this? It should be possible with UI scripting (https://developer.apple.com/library/archive/documentation/LanguagesUtilities/Conceptual/MacAutomationScriptingGuide/AutomatetheUserInterface.html), but it'll be much faster to just uncheck the boxes. (https://xkcd.com/1319/)

– slhck – 2020-01-14T12:19:40.980

my company needs to clone a Mac mini several times a day to create perfect copies. The are all linked together with a unique iCloud ID with desktop and documents syncing, so every machine is always up to date. We are using Carbon Copy Cloner to do that, unfortunately it does not copy those settings – liuk – 2020-01-14T17:10:16.570

haha, you graph is funny! unfortunately it does not apply here! ;-) – liuk – 2020-01-14T17:12:13.783

Answers

0

See this answer on Apple.SE, which suggests:

tell application "System Preferences" to set current pane to pane "iCloud"
tell application "System Events"
    tell window "iCloud" of process "System Preferences"
        set btmmBox to checkbox 1 of UI element 1 of row 1 of table 1 of scroll area 1 of group 1
        tell btmmBox
            if not (its value as boolean) then click btmmBox
        end tell
        --get value of btmmBox
    end tell
end tell

This will only check the first element, i.e. iCloud Drive, but you can work your way through the others based on the syntax.

slhck

Posted 2020-01-14T11:33:35.890

Reputation: 182 472