touch bar kkbox 歌曲資訊 btt - MAC

By Kelly
at 2018-02-10T19:07
at 2018-02-10T19:07
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
--
雖然 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
--
Tags:
MAC
All Comments

By Kristin
at 2018-02-12T23:58
at 2018-02-12T23:58

By Carolina Franco
at 2018-02-14T13:22
at 2018-02-14T13:22

By Dorothy
at 2018-02-19T03:40
at 2018-02-19T03:40

By Barb Cronin
at 2018-02-20T13:01
at 2018-02-20T13:01

By Andy
at 2018-02-25T07:33
at 2018-02-25T07:33

By Elvira
at 2018-02-27T16:43
at 2018-02-27T16:43

By William
at 2018-02-28T05:34
at 2018-02-28T05:34

By Irma
at 2018-02-28T10:22
at 2018-02-28T10:22
Related Posts
提醒事項通知一直標示有一個未讀通知

By Lauren
at 2018-02-10T12:16
at 2018-02-10T12:16
macbook pro 2015 / 2017 選擇

By Barb Cronin
at 2018-02-10T11:39
at 2018-02-10T11:39
parallel 開bootcamp無法進入桌面

By Dora
at 2018-02-10T10:31
at 2018-02-10T10:31
使用type-c hub 同時外接htmi&vga的問題

By Annie
at 2018-02-10T09:59
at 2018-02-10T09:59
MacBookAir2015整修vs 2017新品

By Queena
at 2018-02-10T01:48
at 2018-02-10T01:48