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方法,需要在播放完成之后手动关闭播放器。

  • 相关阅读:
    一分钟 解决Tomcat端口 占用问题
    Java 自定义注解
    Java 解析自定义XML文件
    Junit(手动/自动)加载
    Java思维题
    SSM框架中使用日志框架
    DAC
    SPI接口的FLASH
    晶振测试起振方法
    Jlink不报错的方法
  • 原文地址:https://www.cnblogs.com/vectorli/p/4429318.html
Copyright © 2011-2022 走看看