3

I want to have an application open a new window in the current space without switching to a space in which a window is already open, but I want to keep the

When switching to an application, switch to a space with open windows for the application

setting in System Preferences > Mission Control.

In other words, I want to tell an application to open a new window directly, without first telling it to activate.

How can I do this with AppleScript (if possible)?

2 Answers 2

1

Mission Control is not scriptable as far as I am aware. Its actually one of things that Apple needs to correct in hindsight. I've been wanting to make a app that sets up my workspace and gets it ready for work for a week now.

0

This is as close as I could get...

set APP_TO_OPEN to "Dictionary"

do shell script "/Applications/Mission\\ Control.app/Contents/MacOS/Mission\\ Control"
delay 0.5
tell application "System Events" to tell process "Dock"
    set countSpaces to count buttons of list 1 of group 1
    click button 1 of group 1
    repeat until (count buttons of list 1 of group 1) = (countSpaces + 1)
    end repeat
    click button (countSpaces + 1) of list 1 of group 1
end tell
delay 0.5
do shell script "/Applications/Mission\\ Control.app/Contents/MacOS/Mission\\ Control 1"
tell application APP_TO_OPEN to activate
1
  • 1
    What do you mean by "as close as"? What does work, what doesn't?
    – nohillside
    Sep 9, 2015 at 5:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .