簡體   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