so in my program there is a section of code that when you click a button it displays the current track title,artist and album in a dialog box.
It all works fine except when there is no song playing…i don’t mean paused or stopped, i mean right when you open iTunes there is no song playing and I want to have the dialog box say No Song playing, but when you run the program I just get the error that iTunes can’t get current track name.
Heres my code right now fo this:
if the name of theObject is equal to "get_info" then
tell application "iTunes"
set thetitle to (name of current track)
set theartist to (artist of current track)
set thealbum to (album of current track)
if thetitle is "" then
set thetitle to "No song playing"
set theartist to ""
set thealbum to ""
else if theartist is equal to "" then
set thetitle to (name of current track)
set theartist to "Unknown Artist"
set thealbum to (album of current track)
else if thealbum is equal to "" then
set thetitle to (name of current track)
set theartist to (artist of current track)
set thealbum to "Unknown Album"
end if
end tell
output(thetitle & return & theartist & return & thealbum)
end if
end clicked
---this prompts the track info dialog----
on output(str)
display dialog str
end output
i also need help so that when you quit iTunes it quits my program as well. Thanks!