Script to turn off work accounts


I am trying to use Scriptable to write a script that would allow me to make a Siri Shortcut to turn off my work email and then turn off Slack notifications / then allow me to turn them back on later instead of having to manually go into settings and have to toggle all those different settings.

I am not sure if it is even possible given that Apple sandboxes alot of things but IF it is possible could someone tell me where to start?

What do you mean by “turn off”? Simply not receive notifications? Not pull mail from the server? Something else?

As far as email goes, I would like to turn the account off just like when you go to settings —> mail —> accounts then you can toggle the account on or off so I guess what I am looking for is the ability to toggle that switch w/ out having to go through all the settings to do that. But ideally I would also like this short cut to also turn off/on the notifications for slack and a couple of other work apps — essentially a work mode / non-work mode

Like I said I know /i can go into setting and toggle a bunch of switches but that is cumbersome and it would be nice to have a short cut to toggle these switches

Afaik, there’s no possibility to script preferences. There’s a shortcut that permits you to open the relevant page in preferences, but that’s as far as it goes, I think.
In any case, I see only the option to log out from an account. If it’s that what you mean: logging on again via scripting is probably not possibly because of security concerns.

1 Like

I am not looking to logout of the account just turn the account toggle on or off

Not sure those pics uploaded properly as i am writing this from my iPad but I just want to toggle the on/off switch when you go to settings —> mail —> accounts —> then you tap on an account and you see mail there is a toggle

As @chrillek said, it probably isn’t possible. Shortcuts and Scriptable only have access to controls and settings that the OS allows them to have.

Unlike on the Mac or a more open system, workarounds like UI scripting don’t really work on iOS. You’re stuck with what Apple gives you.