AppleScript的; 在空格号N中打开一个应用程序

Ope*_*way 7 macos applescript

我想知道在applescript中是否有可能创建一个脚本,我们将其作为输入提供应用程序名称和数字N,因此这个应用程序在Space的空格编号N中打开.

我想用这个来创建一个meta-applescript,所以当计算机启动和登录后,在每个空间我得到不同的应用程序,重要的是,我可以在脚本文件中更改它,而不是通过mac os x Space的首选项

谢谢

Ned*_*ily 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
Run Code Online (Sandbox Code Playgroud)

如果您还不知道,可以从Finder获取应用程序的软件包ID:

tell application "Finder"
    get id of application file "TextEdit" of folder "Applications" of startup disk
end tell
Run Code Online (Sandbox Code Playgroud)

  • 请注意,在OS X 10.7中,"空间首选项"对象再次消失 (2认同)
  • 空间首选项在 10.10 和 10.11(测试版)中也不可用。:-( (2认同)