【发布时间】:2013-09-02 20:46:48
【问题描述】:
我有一个在 Mac OS X(X.5 到 X.8)机器上使用的 bash 脚本。在这是一个对话框情况,要求通过按“确定”继续脚本或通过按“打盹”让脚本打盹。那部分正在工作。
但是,我正在测试脚本并且无法立即按下任一按钮,并且在一两分钟后(我没有计时),脚本继续执行其余过程,让对话框停留在屏幕。
我的印象是脚本必须等待用户输入?
部分脚本:
osascript -e '告诉应用“Finder”激活'
return=osascript -e 'tell app "Finder" to display dialog "Text goes here. Please select OK or Snooze" buttons {"OK", "Snooze"} default button 1 with title "Text Here" with icon caution'
############ BEGIN LOOP HERE ##############
while [ "$return" == "button returned:Snooze" ]
do
Runs every 4 hours
sleep 14400
osascript -e 'tell app "Finder" to activate'
return=`osascript -e 'tell app "Finder" to display dialog "Text goes here. Please select OK or Snooze" buttons {"OK", "Snooze"} default button 1 with title "Text Here" with icon 2'`
完成
###### 在这里结束循环 if [ "$return" == "button returned:OK" ]
then
run the installer script here
fi
【问题讨论】:
标签: macos bash dialog osascript