ASObjc Runner的shellcript进度

时间:2015-07-01 13:43:53

标签: applescript

我正在尝试使用ASObjC Runner制作进度条。 进度条必须显示shell脚本的进度,在本例中为“sleep 5”。我想出了这个剧本:

    repeat with i from 1 to 100
    do shell script "sleep 5"
    tell application "ASObjC Runner"
        reset progress
        activate
        show progress
        set properties of progress window to {detail:"Progress: " & i, current value:i}
        if button was pressed of progress window then
            exit repeat
        end if
    end tell
end repeat
tell application "ASObjC Runner" to quit

但是如果shell脚本完成,他的脚本只会将进度条更新1%,因此需要5秒才能获得1%的进度。 是否可以使其工作,因此shell脚本完成后进度条为100%。 帮助appriciated!

1 个答案:

答案 0 :(得分:0)

如果你想在shell脚本运行时更新进度条,我担心这是不可能的。 AppleScript中的Shell脚本同步运行,您的代码执行此操作(逐步)

  • 脚本启动
  • 脚本等待5秒
  • 脚本开始与ASObjC Runner交谈