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

  • 相关阅读:
    通过 Ansible role 安装 Jenkins Server
    常见 Bash 内置变量介绍
    Ansible 简介
    为容器化的 Go 程序搭建 CI
    Bash Shebang 小结
    Docker Compose 引用环境变量
    Docker Compose 之进阶篇
    Docker Compose 原理
    WEB程序调用客户端程序
    读书笔记2014第5本:《乔纳森传》
  • 原文地址:https://www.cnblogs.com/vectorli/p/4429318.html
Copyright © 2020-2023  润新知