LaunchBarからiTunesの現在の曲にレーティングするAppleScriptスクリプト

LaunchBarからiTunesの再生中の曲にレートをつけるスクリプトを作成。Genius Mixでは利用できないみたい。

tell application "iTunes"
	set targetId to database ID of current track
	set targetTrack to item 1 of (every track of current playlist whose database ID is targetId)
 
	set ratings to {"・・・・・", "★・・・・", "★★・・・", "★★★・・", "★★★★・", "★★★★★"}
	set selectedItem to item 1 of {choose from list ratings}
	if selectedItem = false then return
 
	set selectedRating to item 1 of selectedItem
 
	if selectedRating = "・・・・・" then
		set ratingNumber to 0
	else if selectedRating = "★・・・・" then
		set ratingNumber to 20
	else if selectedRating = "★★・・・" then
		set ratingNumber to 40
	else if selectedRating = "★★★・・" then
		set ratingNumber to 60
	else if selectedRating = "★★★★・" then
		set ratingNumber to 80
	else if selectedRating = "★★★★★" then
		set ratingNumber to 100
	end if
 
	set rating of targetTrack to ratingNumber
end tell

LaunchBarからiTunesの現在の曲のレーティングを表示するAppleScriptスクリプトを作成

iTunes for Mac まとめ – AppleScriptを参考に作成。

tell application "iTunes"
	set targetTrack to rating of current track
end tell
if targetTrack = 0 then
	set hoshi to "・・・・・"
else if targetTrack = 20 then
	set hoshi to "★・・・・"
else if targetTrack = 40 then
	set hoshi to "★★・・・"
else if targetTrack = 60 then
	set hoshi to "★★★・・"
else if targetTrack = 80 then
	set hoshi to "★★★★・"
else if targetTrack = 100 then
	set hoshi to "★★★★★"
end if
tell application "LaunchBar"
	display in large type hoshi
	delay 1
	hide
end tell