OSX Lion AppleScript : How to get current space # from mission control?

前端 未结 7 1081
悲&欢浪女
悲&欢浪女 2020-12-07 11:09

I\'m trying to figure out how to get the current space # from mission control. Source would be helpful, but more helpful would be info on how to figure this out myself. I\

相关标签:
7条回答
  • 2020-12-07 12:12
    on openNewSpace()
        tell application "System Events"
            —start mission control
            do shell script "/Applications/Mission\\ Control.app/Contents/MacOS/Mission\\ Control"
            tell process "Dock"
                set countSpaces to count buttons of list 1 of group 1
                --new space
                click button 1 of group 1
                --switch to new space
                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
        end tell
    end openNewSpace
    
    0 讨论(0)
提交回复
热议问题