2010-02-21 20 views
7

中打開應用程序我不知道是否可以在applescript中創建一個腳本,我們將其輸入爲應用程序名稱和數字N,以便此應用程序在空間的空間編號N中打開。Applescript;在空間編號N

我想用這個來創建一個meta-applescript,所以當計算機啓動時和登錄後,在每個空間我得到不同的應用程序,重要的是,我可以在腳本文件中更改此內容,而不是通過mac os x Space的首選項

由於

+2

目前接受的答案似乎不工作在10.8。任何人都知道如何做到這一點? – finiteloop

+0

那麼OSX 10.9小牛呢? :) – neu242

回答

7

在OS X 10.5或10.6,Spaces分配可以被訪問並通過編寫腳本的界面改變爲System Events.app

tell application "System Events" 
    set x to application bindings of spaces preferences of expose preferences 
    set x to {|com.apple.textedit|:4} & x -- Have TextEdit appear in space 4 
    set application bindings of spaces preferences of expose preferences to x 
end tell 

如果你不知道的話,你可以從Finder中的應用程序的包ID:

tell application "Finder" 
    get id of application file "TextEdit" of folder "Applications" of startup disk 
end tell 
+0

這太棒了! 只是慾望的問題,我怎麼能改變textedit雷鳥? – flow

+0

查看上面編輯的答案。 –

+2

請注意,在OS X 10.7中,「空間首選項」對象再次消失 – Robin

0

本工程以切換回太空2,然後在空間1:

tell application "System Events" 
    key code 19 using {control down} -- control+2 is switch to Display Space 2 
end tell 
delay 1.0 

tell application "System Events" 
    key code 18 using {control down} -- control+1 is switch to Display Space 1 
end tell 
delay 1.0