AppleScript Help Please

Joined
Feb 25, 2007
Messages
194
Reaction score
12
Points
18
Location
Lancaster PA
Your Mac's Specs
G3 iMac 400Mhz, 512Mb RAM,10GB HDD
Is anyone familiar with AppleScripts? I'm using one for a now-playing for xchat... I use an alias to execute the script and output it into the active channel...


Here's my script:

Code:
tell application "iTunes"
	"Now playing: " & artist of current track ¬
		& " - " & name of current track
end tell

Pretty simple, right? It works excellent for tracks ON my computer... When I play the iTunes radio it outputs something like this
Code:
"Now playing: missing value - Alt X Radio"

How could I make it output the track title and artist? It clearly shows them in iTunes...:eek:neye:
 
Joined
Mar 19, 2007
Messages
1,814
Reaction score
137
Points
63
Location
NY USA
Your Mac's Specs
iMac 5.1 | iMac 7.1 | iMac 12.1 | iMac 19.1 | iPhone 11 Pro | Watch s5
So I guess you'd have to wrap the artist query in a conditional statement. If artist not bank then display artist & " - ".
After that, continue with name of current track.

I'm no script expert... so dont follow that exactly. It's the english logic, no the correct syntax.
 
Joined
Mar 19, 2007
Messages
1,814
Reaction score
137
Points
63
Location
NY USA
Your Mac's Specs
iMac 5.1 | iMac 7.1 | iMac 12.1 | iMac 19.1 | iPhone 11 Pro | Watch s5
GOT IT!

Code:
tell application "iTunes"
    current stream title
end tell
 
Joined
Mar 19, 2007
Messages
1,814
Reaction score
137
Points
63
Location
NY USA
Your Mac's Specs
iMac 5.1 | iMac 7.1 | iMac 12.1 | iMac 19.1 | iPhone 11 Pro | Watch s5
This was fun!!

Code:
tell application "iTunes"
    set myinfo to ""
    if kind of the current track does not contain "file" then set myinfo to "Now streaming: " & current stream title & " - " & name of current track & " (" & current stream URL & ")"
    if kind of the current track contains "file" then set myinfo to "Now playing: " & artist of current track & " - " & name of current track
    myinfo
end tell
 
OP
IceCreamMan
Joined
Feb 25, 2007
Messages
194
Reaction score
12
Points
18
Location
Lancaster PA
Your Mac's Specs
G3 iMac 400Mhz, 512Mb RAM,10GB HDD
Thanks! Works perfectly.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top