我正在寻找方法来减少浪费时间来打开所需的所有应用程序,定位窗口,打开网址/文件/更改目录/等等。在实际编码开始之前。
在完美的世界中,每个'项目'会有2个标记为'SAVE STATE'和'RESTORE STATE'的按钮。你在某些游戏中找到的那种功能。
我在Mac上,花了几个小时用“Automator”敲打我的头部(由于某种原因甚至在码头打开firefox时出现问题)然后AppleScript(这让我感觉我在很长一段路。)
在网上搜索让我看到了这个剧本:
http://snipt.net/Fotinakis/applescript-to-save-and-restore-window-positions/
#!/usr/bin/osascript
-- Usage:
-- $ osacompile -o windowPositions.compiled.scpt windowPositions.scpt
-- $ osascript windowPositions.compiled.scpt --save
-- $ osascript windowPositions.compiled.scpt --restore
-- Change this to be the list of windows you want to save/restore
property affectedProcesses : {"Chrome", "Adium", "Eclipse", "Terminal"}
property windowRecord : {}
on run argv
if (count of argv) is equal to 0 then
log "Please specify one of --save or --restore."
return
end if
tell application "System Events"
if (item 1 of argv is equal to "--save") then
set windowRecord to {}
repeat with i from 1 to count affectedProcesses
set end of windowRecord to {0, {}, {}}
end repeat
repeat with p from 1 to count affectedProcesses
set processName to (item p of affectedProcesses)
if exists process processName then
log "Process '" & processName & "' exists"
tell process processName
set numWindows to count windows
set item 1 of item p of windowRecord to numWindows
repeat with i from 1 to numWindows
set end of item 2 of item p of windowRecord to position of window i
set end of item 3 of item p of windowRecord to size of window i
end repeat
end tell
end if
end repeat
else
repeat with p from 1 to count affectedProcesses
set processName to (item p of affectedProcesses)
if exists process processName then
log "Process '" & processName & "' exists"
tell process processName
set numWindows to item 1 of item p of windowRecord
repeat with i from 1 to numWindows
set position of window i to (item i of item 2 of item p of windowRecord)
set size of window i to (item i of item 3 of item p of windowRecord)
end repeat
end tell
end if
end repeat
end if
end tell
end run
它完成了一半的工作(调整大小和位置当前窗口)但在多显示器多桌面设置上崩溃了。原作者没有联系信息可以寻求帮助或反馈。
任何人都可以了解如何保存和恢复应用程序和布局?感觉就像这样一个常见的任务,应该有一些帮助工具。我所拥有的最好的是“睡眠模式”,但似乎我必须每隔一天进行一次完全重启,并为不同的项目提供不同的应用程序和布局。