我想有一个在Mac OS X下的应用程序,使我有Sublime文本2和终端(用于显示测试结果,运行grunt任务等)在同一个全屏窗口。我找不到有这种行为的应用程序,我想自己用可可拆分视图重现它。我想知道这是否可行,如果可行,我如何开始实施它
谢谢
发布于 2013-01-15 01:30:11
您不能从2个其他应用程序创建新应用程序。恐怕行不通。但是,您可以使用applescript轻松地根据需要定位这些窗口。
作为示例,我将使用Safari和Terminal作为我的两个应用程序。打开它们,并将它们放在屏幕上您希望它们出现的位置。我将每个窗口都打开得很大,并将它们并排放置。然后我运行这个applescript来获取它们的窗口大小和位置属性...
tell application "System Events"
tell process "Safari"
set safariSize to size of window 1
set safariPosition to position of window 1
end tell
tell process "Terminal"
set terminalSize to size of window 1
set terminalPosition to position of window 1
end tell
end tell
return {safariSize, safariPosition, terminalSize, terminalPosition}然后,我将该脚本的结果复制/粘贴到该脚本的"theValues“变量中。现在,只要我愿意,我就可以运行这个脚本来重新创建这些窗口位置。
set theValues to {{1001, 1025}, {0, 22}, {613, 1024}, {1003, 22}}
tell application "Safari" to activate
tell application "Terminal" to activate
tell application "System Events"
tell process "Safari"
set size of window 1 to item 1 of theValues
set position of window 1 to item 2 of theValues
end tell
tell process "Terminal"
set size of window 1 to item 3 of theValues
set position of window 1 to item 4 of theValues
end tell
end tell我希望这能有所帮助。祝好运。
https://stackoverflow.com/questions/14320740
复制相似问题