iTunesで再生した曲をtweetする
と思ったけど、よく考えたら通知センターに表示された内容はtweetされちゃうな……
10.9上でTwitter Scripterを利用してます。
on idle {}
main()
return 4
end idle
on main()
set {aTitle, Artist_Album} to my getNotfication()
my tweet(aTitle, Artist_Album)
end main
on tweet(aTitle, Artist_Album)
tell application "Twitter Scripter"
tweet aTitle & "\n" & Artist_Album using account "Twitter Accounts"
end tell
end tweet
on getNotfication()
tell application "System Events"
tell process "通知センター"
set notificationWindow to window 1 whose subrole is "AXNotificationCenterAlert" or subrole is "AXNotificationCenterBanner"
tell scroll area 1 of notificationWindow
--曲名
set aTitle to the value of static text 1
--アーティスト — アルバム
set Artist_Album to the value of static text 2
end tell
return {aTitle, Artist_Album}
end tell
end tell
end getNotfication