开发者

Open an application in a space using applescripts

I am trying to create a script that will open an application in a specific "space". So let开发者_Go百科's say I am on space 1 working in the terminal and then I want to be able to open safari in space 4. Is there a way to do this?

I have done some searching and found only ways to set the system profile options. Maybe I should tell you my end goal in case what I am attempting is not possible.

I use a laptop and plugin in to multiple stations, home, office, and travel. I want to create different window layouts for each one. So I will need an apple script telling it to open applications in varios spaces and different dimensions. I hope this makes sense. Ask me for clarification if it doesn't thanks!

PS the answer doesn't necessarily have to be any applescript I just thought that would be the easiest way :)


Here's a list of applescript commands for Spaces. There's a couple things there that might help you.


It is possible to do some scripting of application Space preferences by using the scripting interface to the System Events.app. See the answer to a similar question here.


The easiest way I've found is via GUI scripting. Make sure the Spaces menu is active on the upper right of your computer. That lists the spaces by number. You can then just write a GUI script to select the menu item of the space you wish. That will switch to that space. Then do an activate Applescript to open the application there.

Let me know if you need sample code demonstrating this. I have some in Python + Appsscript that does this but I should be easily able to convert it back to Applescript proper if you need it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜