Applescript執行一串指令? - MAC

By Jessica
at 2012-01-21T17:25
at 2012-01-21T17:25
Table of Contents
※ 引述《gullcity ()》之銘言:
: 我想開啟的一個程式每次都要打開Termianl
: 然後
: 輸入cd /Applications/docear-1.0.0_alpha_build6/ 按enter
: 再輸入./docear.sh
: 於是我想用Automator中的run Applescript幫忙
: 在google之後
: 我只會做到這一步
: on run {input, parameters}
: tell application "Terminal"
: activate
: do script with command "cd /Applications/docear-1.0.0_alpha_build6/"
: end tell
: end run
: 但是cd /Applications/docear-1.0.0_alpha_build6/完後
: ./docear.sh的部份卻沒有辦法做到
: 有沒有人可以告訴我該如何寫?
Applescript 的終端機指令系列是把每一個指令於分開的 shells 執行
所以你在兩行指令做兩件事會讓它開兩個 shells 分別做, 不會連續
這有很多種解法
例如用 && (cd /Applications/docear-1.0.0_alpha_build6/ && ./docear.sh)
或者直接用絕對路徑執行 (/Applications/docear-1.0.0_alpha_build6/docear.sh)
是比較簡單的選項
不過你只是要執行一個 shell script 檔而已, 還要用 AppleScript 包起來有點多餘
直接改拉工具程式->執行 Shell 工序指令
然後把你原本那兩行打進去就可以了
或者更簡單
直接 cd /Applications/docear-1.0.0_alpha_build6/ && chmod +x docear.sh
然後把 docear.sh 這個檔建立一個替身, 直接點兩下就可以執行了...
--
Les grandes et les meilleurs tone from "Zadok the Priest"
Eine grosse stattliche Veranstaltung by F. Handel
THE MAIN EVENT! These are the men
Sie sind die Besten
"Champions League" by Tony Britten THESE ARE THE CHAMPIONS!
--
: 我想開啟的一個程式每次都要打開Termianl
: 然後
: 輸入cd /Applications/docear-1.0.0_alpha_build6/ 按enter
: 再輸入./docear.sh
: 於是我想用Automator中的run Applescript幫忙
: 在google之後
: 我只會做到這一步
: on run {input, parameters}
: tell application "Terminal"
: activate
: do script with command "cd /Applications/docear-1.0.0_alpha_build6/"
: end tell
: end run
: 但是cd /Applications/docear-1.0.0_alpha_build6/完後
: ./docear.sh的部份卻沒有辦法做到
: 有沒有人可以告訴我該如何寫?
Applescript 的終端機指令系列是把每一個指令於分開的 shells 執行
所以你在兩行指令做兩件事會讓它開兩個 shells 分別做, 不會連續
這有很多種解法
例如用 && (cd /Applications/docear-1.0.0_alpha_build6/ && ./docear.sh)
或者直接用絕對路徑執行 (/Applications/docear-1.0.0_alpha_build6/docear.sh)
是比較簡單的選項
不過你只是要執行一個 shell script 檔而已, 還要用 AppleScript 包起來有點多餘
直接改拉工具程式->執行 Shell 工序指令
然後把你原本那兩行打進去就可以了
或者更簡單
直接 cd /Applications/docear-1.0.0_alpha_build6/ && chmod +x docear.sh
然後把 docear.sh 這個檔建立一個替身, 直接點兩下就可以執行了...
--
Les grandes et les meilleurs tone from "Zadok the Priest"
Eine grosse stattliche Veranstaltung by F. Handel
THE MAIN EVENT! These are the men
Sie sind die Besten
"Champions League" by Tony Britten THESE ARE THE CHAMPIONS!
--
Tags:
MAC
All Comments

By Faithe
at 2012-01-26T13:56
at 2012-01-26T13:56
Related Posts
有點想要入手二手小白

By Faithe
at 2012-01-21T16:23
at 2012-01-21T16:23
Applescript執行一串指令?

By Jacky
at 2012-01-21T15:57
at 2012-01-21T15:57
2011 2.0GHZ 15吋 霧面的行情約多少?

By Madame
at 2012-01-21T15:40
at 2012-01-21T15:40
MAC大哉問,在買MAC前你要知道的事情(重新排版完成)

By Delia
at 2012-01-21T13:43
at 2012-01-21T13:43
parallels desktop 7 接晶片讀卡機

By Quintina
at 2012-01-21T09:19
at 2012-01-21T09:19