繁体   English   中英

zsh脚本启动Terminal.app而不是iTerm.app

[英]zsh script launches Terminal.app instead of iTerm.app

我正在尝试使用Jim Fisher编写的OSX terminal.app的zsh rails工作区启动器。 我在OSX 10.6.8上。 我希望它在iTerm中启动,但继续在Terminal中启动。 外壳是/ bin / zsh

下面是我稍作修改的脚本。 任何帮助总是感激不尽!

    rails_workspace()

    {
osascript -e 'tell application "iTerm.app"' \
-e 'tell application "System Events" to tell process "iTerm.app" to keystroke "t" using command down' \
-e "do script with command \"cd `pwd`;clear;\" in selected tab of the front window" \
-e "do script with command \"rails server\" in selected tab of the front window" \
-e 'tell application "System Events" to tell process "iTerm.app" to keystroke "t" using command down' \
-e "do script with command \"cd `pwd`;clear;\" in selected tab of the front window" \
-e "do script with command \"rails console\" in selected tab of the front window" \
-e 'tell application "System Events" to tell process "iTerm.app" to keystroke "t" using command down' \
-e "do script with command \"cd `pwd`;clear;\" in selected tab of the front window" \
-e "do script with command \"tail -f log/development.log\" in selected tab of the front window" \
-e 'end tell' &> /dev/null
sleep 2
subl .
open "http://localhost:3000"
    }
    alias rw=rails_workspace

我发现上面的代码是在zsh中启动的Applescript。 因此,我写了自己的Applescript作为Automator任务:

 tell application "Finder"
   set project_list to name of folders of folder ("your/projects/folder" as POSIX file)
 end tell

 (choose from list project_list with prompt "What project do you want?")
   set project to result as text

 tell application "iTerm"
   activate
   terminate the first session of the first terminal

   set myterm to (make new terminal)

   tell myterm
     set mysession to launch session "Default Session"
     tell mysession
        write text "website"
        write text project
     end tell

     set mysession2 to launch session "Default Session"
     tell mysession2
        write text "website"
        write text project
        write text "rails console"
     end tell

     set mysession3 to launch session "Default Session"
     tell mysession3
        write text "website"
        write text project
        write text "tail -f log/development.log"
     end tell
   end tell
 end tell

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM