2012-08-02 102 views

回答

3

在Maverics有可能觸發來自蘋果腳本的通知,但如果它工作在山獅不知道:

display notification "Hello!" 

我做了一個簡單的命令行腳本參數傳遞給一個蘋果腳本。單行安裝:

echo -e '#!/bin/bash\n/usr/bin/osascript -e "display notification \"$*\""'|sudo -s "cd /usr/local/bin;tee notify&&chmod +x notify" 

將輸出代碼放到/ usr/local/bin(必須存在)並添加可執行標誌。確保/ usr/local/bin位於$ PATH中。

#! /bin/bash 
/usr/bin/osascript -e "display notification \"$*\"" 

現在顯示通知:

notify "Lorem ipsum dolor sit amet" 
sleep 5 ; notify "Slow command finished" 
相關問題