English 中文(简体)
以 Applicscript 关闭快速关闭
原标题:Closing QuickTime by Applescript

I am trying to play a movie fullscreen one time, then close the player programmably. I have tried using QTMovieView, command line and AppleScript and found the Applescript is the most simple way.

但是,因为我真的不知道 Applescript, 我不能让快速汽车关闭 电影播放后。

Everything works fine but the "done" was unrecognized in the repeat line. Here is the script with this error:

错误“ QuickTime Player 获得错误: 无法将文档 1 完成为类型分解符。” 编号 - 1700 从文档 1 完成到 分解符 。

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 

新问题: 应用程序在视频完成前挂起 。

最佳回答

这对我来说管用,但看起来并不怎么有力。是否 保证 : 现时 将永远等同于 < code > duration , 因为它们都是真实的? 您可以在 < code> repeat 条件中加入一些“ 内线” 逻辑。

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
问题回答

尝试 :

tell application "QuickTime Player"
    tell document 1
        present
        play
        repeat until playing is false
            delay 1
        end repeat
    end tell
quit
end tell




相关问题
Display MPEG-4 Export Component Dialog

Below is my code for a doc based QTKit app that exports to the fixed Apple device formats by way of a popUp that displays the three device options. The [NSNumberWithLong:mpg4 ] option works fine as ...

Quicktime Framework and opening Transport Streams

I have noticed that Quicktime 10 is now able to open Transport Stream Video files and also search reliably within that video file(Which is something that VLC can not seem to handle). Quicktime 7, on ...

export to MP3 from quicktime API

A question for Apple,QT programmers. Would like to know if it s possible to export a Movie object to MP3 using the QuickTime API. Preferably the ConvertMovieToFile function. I ve looked at ...

热门标签