前言
蘋果自帶的 QuickTime Player 是一款功能強大的媒體播放器,但在日常使用中,我們可能會發(fā)現(xiàn)它缺少了一個非常實用的功能:即通過方向鍵實現(xiàn)快進/快退。這一功能在大多數(shù)播放器中都是標(biāo)配,但在QuickTime Player中卻未能直接提供。為了滿足這一需求,我們可以通過一些額外的設(shè)置和腳本編寫,來為QuickTime Player增添這一便捷功能。
操作步驟
1. 打開OS X自帶的"自動操作"軟件
首先,我們需要在Mac的OS X系統(tǒng)中找到并打開 "自動操作"(Automator) 這款軟件。這款軟件允許我們創(chuàng)建各種自動化任務(wù)和快捷操作,非常實用。
2. 設(shè)置快捷操作的基本參數(shù)
在 "自動操作" 軟件中,我們需要選擇創(chuàng)建一個新的 "快捷操作"(Quick Action) 。隨后,在 "工作流程收到當(dāng)前" 的設(shè)置中,選擇 "沒有輸入" ,這意味著我們的快捷操作不需要接收任何外部輸入。接著,在 "應(yīng)用程序" 選項中,選擇 "QuickTime Player" ,這樣我們的快捷操作就只會對 QuickTime Player 生效。
3. 添加運行AppleScript動作
在左側(cè)的資源庫面板中,我們可以找到各種可用于自動化任務(wù)的動作。在這里,我們需要找到并拖拽 "實用工具" 中的 "運行AppleScript" 動作到右側(cè)的工作流程區(qū)域。
4. 編寫AppleScript代碼
在拖拽完 "運行AppleScript" 動作后,會出現(xiàn)一個編輯框供我們編寫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秒腳本?。ㄒ獜淖詣硬僮髦性谛陆ㄒ粋€,對應(yīng)這個快退)
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
注意,我們需要分別創(chuàng)建兩個快捷操作來對應(yīng)這兩個腳本
5. 保存服務(wù)
完成腳本編寫后,我們需要保存這個快捷操作。保存后,打開QuickTime Player,在菜單欄中的“服務(wù)”列表中就能看到我們剛剛創(chuàng)建的服務(wù)了。但此時,這些服務(wù)只能通過點擊來運行,還不夠便捷。
6.設(shè)置快捷鍵
現(xiàn)在操作起來不方便,可以給這兩個腳本設(shè)置快捷鍵
偏好設(shè)置->鍵盤->鍵盤快捷鍵 左邊選中”服務(wù)“,右邊就看到”通用“中有我們剛才新增的快進、快退,旁邊有設(shè)置快捷鍵按鈕
注意,由于系統(tǒng)快捷鍵可能存在沖突,所以在設(shè)置快捷鍵時需要確保所選的快捷鍵組合在當(dāng)前系統(tǒng)中未被其他功能占用。