zoukankan      html  css  js  c++  java
  • 使用AppleScript播放指定时间的电影片段

    要在公司中分享一个电影,为了能够简单的播放一些电影的片段,使用AppleScript和MPlayerX的seekto功能来播放指定时间段的电影。

    tell application "Finder"
        open document file "xxx.mkv" of folder "Movies" of folder "vector" of folder "Users" of startup disk using application file "MPlayerX.app" of folder "Applications" of startup disk
        tell application "MPlayerX"
            activate
            pause
            delay 1
            set isFullScreenAfter to false
            tell application "System Events"
                try
                    tell front window of (first process whose frontmost is true)
                        set isFullScreen to get value of attribute "AXFullScreen"
                        set isFullScreenAfter to not isFullScreen
                        set value of attribute "AXFullScreen" to isFullScreenAfter
                    end tell
                end try
            end tell
            delay 1
            (* seekto 1539*)
            seekto 1650
            play
        end tell
        delay 82
        tell application "MPlayerX"
            tell application "System Events"
                try
                    tell front window of (first process whose frontmost is true)
                        set isFullScreen to get value of attribute "AXFullScreen"
                        set isFullScreenAfter to not isFullScreen
                        set value of attribute "AXFullScreen" to isFullScreenAfter
                    end tell
                end try
            end tell
            pause
            delay 1
        end tell
    end tell 

    打开电影后自动全屏播放,等待一段时间后退出全屏并暂停。

    由于MPlayerX没有close方法,需要在播放完成之后手动关闭播放器。

  • 相关阅读:
    loadrunner 11安装教程
    测试用例
    软件测试分类
    软件测试模型
    VMware Workstation安装Red hat7.0联网问题总结
    Python网络编程基础pdf
    Python数据可视化编程实战pdf
    Python数据分析实战
    Python数据科学手册
    Python入门经典. 以解决计算问题为导向的Python编程实践
  • 原文地址:https://www.cnblogs.com/vectorli/p/4429318.html
Copyright © 2011-2022 走看看