property myPlayList : ""
property okflag : false
if myPlayList = "" then
display dialog "新規プレイリストを作成" default answer "プレイリスト名"
set myPlayList to text returned of result
tell application "iTunes"
set newPlayList to make new playlist with properties {name:myPlayList}
end tell
else
tell application "Finder"
if (get name of every process) contains "iTunes" then
set okflag to true
end if
end tell
if okflag then
try
tell application "iTunes"
set currentList to playlist myPlayList
add (get location of current track) to currentList
set theTrack to name of current track
end tell
on error
set myPlayList to ""
end try
set hoge to theTrack & "を" & myPlayList & "に追加しました"
display dialog hoge buttons {"違うプレイリストに曲を登録する", "OK"} default button 2 giving up after 2
set reset_button to button returned of result
if reset_button = "違うプレイリストに曲を登録する" then set myPlayList to ""
end if
end if