以下是一个使用AppleScript的示例代码,可以打开两个应用程序并以全屏模式(并排)打开:
tell application "Finder"
set desktopSize to bounds of window of desktop
end tell
tell application "System Events"
set appName1 to "Safari"
set appName2 to "TextEdit"
tell process appName1
if not (frontmost of it) then
activate
end if
end tell
tell process appName2
if not (frontmost of it) then
activate
end if
end tell
tell process "Finder"
set position of window appName1 to {0, 22}
set size of window appName1 to {(item 3 of desktopSize) / 2, (item 4 of desktopSize)}
set position of window appName2 to {(item 3 of desktopSize) / 2, 22}
set size of window appName2 to {(item 3 of desktopSize) / 2, (item 4 of desktopSize)}
end tell
end tell
你可以将上述代码保存为一个扩展名为.applescript
的文件,然后在终端中执行以下命令来运行该脚本:
osascript /path/to/your/script.applescript
请注意,你需要将/path/to/your/script.applescript
替换为你保存代码文件的实际路径。此外,你还需要将appName1
和appName2
替换为你想要打开的两个应用程序的名称。
运行脚本后,Safari和TextEdit应该会以全屏模式(并排)打开。