touch bar kkbox 歌曲資訊 btt - MAC

Table of Contents

無聊寫了一下 AppleScript

雖然 KKBOX 不支援 AppleScript

但是可以用 notification 硬搞出來

on isRunning(theAppName)
tell application "System Events" to (name of processes) contains
theAppName
end isRunning
if isRunning("KKBOX") then
set theContentNames to {}
tell application "System Events"
tell process "NotificationCenter"
repeat with theWindow in windows
set theContents to entire contents of theWindow
repeat with theContent in theContents
if class of theContent is static text then
set end of theContentNames to name of theContent
end if
end repeat
end repeat
end tell
end tell
if length of theContentNames >= 3 then
if item 2 of theContentNames is equal to missing value then
set theResult to (item 1 of theContentNames) & (item 3 of
theContentNames)
do shell script "echo \"" & theResult & "\" > ~/btt_kkbox"
end if
else
set theResult to do shell script "cat ~/btt_kkbox"
end if
return theResult
else
return "KKBOX"
end if

https://raw.githubusercontent.com/erikkkerikkk/btt/master/README.md

--

All Comments

Kristin avatarKristin2018-02-12
請問大大把kkbox改成itunes也可以用嗎?
Carolina Franco avatarCarolina Franco2018-02-14
應該也是可以 我不確定 但itunes應該不用這麼複雜的方法
Dorothy avatarDorothy2018-02-19
set track_name to the name of the current track
Barb Cronin avatarBarb Cronin2018-02-20
Andy avatarAndy2018-02-25
感謝大大
Elvira avatarElvira2018-02-27
請問大大 這個要怎麼用? 謝謝!
William avatarWilliam2018-02-28
https://imgur.com/a/Rs845 我出現這個訊息
Irma avatarIrma2018-02-28
touch /<path>/btt_kkbox