0

映画をフルスクリーンで1回再生してから、プログラムでプレーヤーを閉じようとしています。QTMovieView、コマンドライン、およびAppleScriptを使用してみましたが、Applescriptが最も簡単な方法であることがわかりました。

しかし、私はApplescriptを本当に知らないので、映画の再生後にQuickTimeを自動的に閉じることはできません。

すべて正常に動作しますが、繰り返し行で「完了」が認識されませんでした。このエラーのあるスクリプトは次のとおりです。

エラー「QuickTimePlayerでエラーが発生しました:ドキュメント1をタイプ指定子に変換できません。」ドキュメント1の完了から指定子までの番号-1700

tell application "QuickTime Player"
  activate
  open "/Users/...real path of the movie.mov"
  present document 1
  play document 1

  repeat until (get done of document 1)
  end repeat

  delay 2
  close document 1
end tell

最後に、これに変更しました、これで大丈夫ですか?

tell application "QuickTime Player"
    quit
end tell
tell application "QuickTime Player"
    activate
    open "/Users/.../...mov"
    tell document 1
        present
        play
        repeat until playing is false
        end repeat
        delay 2
        close
    end tell
    quit
end tell 

新しい問題:ビデオが終了する前にアプリがハングする。

4

2 に答える 2

2

これは私にとってはうまくいきますが、それほど堅牢ではないようです。両方が本物であるとすると、が常に等しくなることが保証されていますか?「イプシロン内」ロジックを条件に入れたい場合があります。current timedurationrepeat

tell application "QuickTime Player"
    play document 1
    repeat until (current time of document 1 = duration of document 1)

    end repeat
    delay 2
    close document 1
end tell
于 2012-05-23T22:51:46.743 に答える
0

試す:

tell application "QuickTime Player"
    tell document 1
        present
        play
        repeat until playing is false
            delay 1
        end repeat
    end tell
quit
end tell
于 2012-05-24T01:33:05.043 に答える