Applescript 防止QuickTime全屏打开的Apple脚本编辑器

Applescript 防止QuickTime全屏打开的Apple脚本编辑器,applescript,quicktime,Applescript,Quicktime,我正在尝试编写一个应用程序,使用脚本编辑器在Mac启动时运行,以便它播放视频,然后关闭应用程序。但我不希望它进入全屏模式,这是它一直在做的自动。这就是我到目前为止所尝试的(即QuickTime上的“适合屏幕”)。。。有什么建议可以替代吗 tell application "System Events" to keystroke "3" using command down 您不需要为此使用系统事件。从您描述的内容来看,这是一个您可以控制的视频-您可能可以

我正在尝试编写一个应用程序,使用脚本编辑器在Mac启动时运行,以便它播放视频,然后关闭应用程序。但我不希望它进入全屏模式,这是它一直在做的自动。这就是我到目前为止所尝试的(即QuickTime上的“适合屏幕”)。。。有什么建议可以替代吗

tell application "System Events" to keystroke "3" using command down

您不需要为此使用系统事件。从您描述的内容来看,这是一个您可以控制的视频-您可能可以编辑它并重新保存

我知道过去可以使用Quicktime player中的AppleScript设置(或取消设置)全屏标志。它甚至可能在GUI中实现

刚刚选中:该属性称为“呈现”,因此您可以执行以下操作:

tell application "QuickTime Player"
    activate
    tell (open file "xyz.m4v")
        set the presenting to false -- disable full screen playback
        play
    end tell
end tell
快速提示:如果您有Mac OS High Sierra或更早版本,您可以从安装QuickTime Player 7。这将允许您播放上个世纪几十种奇特的传统多媒体文件格式,如果您输入Pro键,您将能够对曲目和时间线进行简单编辑,包括设置全屏标志。如果执行此操作,请保存视频(使用新名称)。下次打开该视频时,它将不再全屏显示

让播放机在视频结束后退出比较棘手,但也许你有一个解决方案。如果没有,您可以将其另存为AppleScript应用程序,设置为保持打开状态,在空闲时每秒轮询一次QuickTime Player播放状态(这是最大速率)。电影结束后,AppleScript可以关闭QuickTime播放器并退出。完整脚本如下所示:

tell application "QuickTime Player"
    activate
    tell (open file "Macintosh HD:Users:Laura:Movies:xyz.m4v")
        set the presenting to false -- disable full screen playback
        play
    end tell
end tell
on idle
    tell application "QuickTime Player"

        if document 1 exists then
            tell document 1
                if (not playing) and (current time > (duration - 1)) then
                    quit
                    tell me to quit -- quit the AppleScript itself
                end if
            end tell
        else -- no movie open, perhaps it failed, or got moved
            tell me to quit -- just quit the AppleScript
        end if

    return 1 -- i.e. poll once per second (maximum)
end tell