我正在使用applescript打开我的开发环境。
更新-此脚本有效。我将打开textmate移到了脚本的末尾,现在它的工作更一致了。
tell application "Terminal"
activate
do script "cd web_sites/mydomain" in front window
do script "rvm 1.9.2" in front window
do script "rails server" in front window
end tell
tell application "System Events"
if not (exists process "System Events") then
tell application "System Events" to activate
end if
tell process "Terminal" to (keystroke "t" using command down)
end tell
tell application "Terminal"
do script "cd web_sites/mydomain/public/stylesheets" in front window --> tab 2
do script "rvm 1.9.2" in front window --> tab 2
do script "sass --watch stylin.scss:stylin.css" in front window --> tab 2
end tell
tell application "System Events"
tell process "Terminal" to (keystroke "t" using command down)
end tell
tell application "Terminal"
do script "cd web_sites/mydomain" in front window --> tab 3
do script "rvm 1.9.2" in front window --> tab 3
do script "mate ." in front window
delay 4
do shell script "open -a Firefox http://localhost:3000"
end tell谢谢你的帮助。
发布于 2011-07-11 03:06:09
我看到了三个可能的问题:
tell application "System Events"行嵌套在tell块寻址Terminal中。您应该创建两个tell application "Terminal"块,其中的tell application "System Events"行位于them.告诉应用程序“系统事件”告诉进程“终端”激活(使用向下命令按键"t“)
...to这个区块...
使用{command down} end tell告诉应用程序“系统事件”激活tell进程"Terminal“按键"t”
...should做到了。
System Events两次。应用程序有默认的五分钟退出延迟(System Events将在五分钟不活动后自动退出)。如果您的计算机速度很快,您应该删除第二个activate命令。希望所有这些都能说得通。:)
https://stackoverflow.com/questions/6642560
复制相似问题