phumberdroz
phumberdroz

Reputation: 55

Applescript open new space in Mac OS Sierra

I want to open a new Desktop/Space in Mac OS Sierra. For an Alfred Workflow.

I tried it with a Applescript snippet that I found here: Automator + Applescript how to: new Desktop (open Calendar and Reminders in it)

But this one does not seem to work under Mac OS Sierra.

I opened up the Accessibility Inspector and found out that there are two new groups. https://i.sstatic.net/t9Yl6.png

So I tried this:

tell process "Dock" to tell group 1 to tell group 1 to tell group 1 to tell button 1 to click`
end tell

But it does not click the Button. Maybe someone is able to help me.

Upvotes: 2

Views: 1070

Answers (1)

deiga
deiga

Reputation: 1637

I managed to solve it with the following script

tell application "System Events" to click (every button whose value of 
attribute "AXDescription" is "add desktop") of group "Spaces Bar" of 
group 1 of group "Mission Control" of process "Dock"

Upvotes: 1

Related Questions