给QuickTime播放器添加快进x秒,快退x秒

前言

苹果自带的 QuickTime Player 是一款功能强大的媒体播放器,但在日常使用中,我们可能会发现它缺少了一个非常实用的功能:即通过方向键实现快进/快退。这一功能在大多数播放器中都是标配,但在QuickTime Player中却未能直接提供。为了满足这一需求,我们可以通过一些额外的设置和脚本编写,来为QuickTime Player增添这一便捷功能。

操作步骤

1. 打开OS X自带的"自动操作"软件

首先,我们需要在Mac的OS X系统中找到并打开 “自动操作”(Automator) 这款软件。这款软件允许我们创建各种自动化任务和快捷操作,非常实用。

2. 设置快捷操作的基本参数

“自动操作” 软件中,我们需要选择创建一个新的 “快捷操作”(Quick Action) 。随后,在 “工作流程收到当前” 的设置中,选择 “没有输入” ,这意味着我们的快捷操作不需要接收任何外部输入。接着,在 “应用程序” 选项中,选择 “QuickTime Player” ,这样我们的快捷操作就只会对 QuickTime Player 生效。

3. 添加运行AppleScript动作

在左侧的资源库面板中,我们可以找到各种可用于自动化任务的动作。在这里,我们需要找到并拖拽 “实用工具” 中的 “运行AppleScript” 动作到右侧的工作流程区域。

4. 编写AppleScript代码

在拖拽完 “运行AppleScript” 动作后,会出现一个编辑框供我们编写AppleScript代码。这里我们需要编写两个脚本,一个用于快进10秒,另一个用于快退10秒。以下是这两个脚本的代码:

快进10秒脚本

on run {input, parameters}
    set step to 10
    tell application "QuickTime Player"
        if front document exists then
            if ((current time of front document) + step)(duration of front document) then
                set (current time of front document) to ((current time of front document) + step)
            else
                set (current time of front document) to (duration of front document)
            end if
        end if
    end tell
    return input
end run

快退10秒脚本 (要从自动操作中在新建一个,对应这个快退)

on run {input, parameters}
    set step to 10
    tell application "QuickTime Player"
        if front document exists then
            if ((current time of front document) - step)0 then
                set (current time of front document) to ((current time of front document) - step)
            else
                set (current time of front document) to 0
            end if
        end if
    end tell
    return input
end run

注意,我们需要分别创建两个快捷操作来对应这两个脚本

5. 保存服务

完成脚本编写后,我们需要保存这个快捷操作。保存后,打开QuickTime Player,在菜单栏中的“服务”列表中就能看到我们刚刚创建的服务了。但此时,这些服务只能通过点击来运行,还不够便捷。

6.设置快捷键

现在操作起来不方便,可以给这两个脚本设置快捷键

偏好设置->键盘->键盘快捷键 左边选中”服务“,右边就看到”通用“中有我们刚才新增的快进、快退,旁边有设置快捷键按钮

在这里插入图片描述

注意,由于系统快捷键可能存在冲突,所以在设置快捷键时需要确保所选的快捷键组合在当前系统中未被其他功能占用。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

龙之叶

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值