I have this cool AppleScript and I’m trying to figure out if grabbing the song URL is even possible in order to add to this script.
tell application "iTunes"
set current_song to the name of current track
set current_artist to the artist of current track
set current_album to the album of current track
end tell
-- Change formatting to your liking here.
return "I'm Currently listening to \"" & current_song & "\" by " & current_artist & " from the " & current_album & " " & "album. " & " " & "#NowPlaying "
Model: 2009 iMac
AppleScript: 2.10
Browser: Chrome
Operating System: macOS 10.13
Try asking for the location property
How do I go about asking for a location property within the above AppleScript?
tell application "iTunes" to tell current track
set current_song to its name
set current_artist to its artist
set current_album to its album
set current_location to its location
end tell
-- Change formatting to your liking here.
return "I'm Currently listening to \"" & current_song & "\" by " & current_artist & " from the " & current_album & " album, stored as : “" & current_location & "” #NowPlaying "
Here it return something like :
"I’m Currently listening to "A Bout De Souffle (Blue Rondo A La Turk/Olympia69)" by Claude Nougaro from the Une soirée avec… (Live à Olympia 1969) album, stored as : “SSD 1000:Users:**********:Music:iTunes:iTunes Media:Apple Music:Claude Nougaro:Une soirée avec… (Live à Olympia 1969):12 A Bout De Souffle (Blue Rondo A La Turk_Olympia69).m4p” #NowPlaying "
Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mercredi 10 juin 2020 03:07:47
Based on the context, I’m fairly certain the OP is talking about streaming audio. If it’s a stream, there is no location, which is a disk’s music file and which would be meaningless to others without access to your device. A stream is a URL track and has an ‘address’ property that is set by the service provider in some circumstances; regarding the latter point, podcasts—at least of the Apple Store variety—don’t have addresses.
tell application "iTunes"
try
tell current track to display dialog "name: " & name & return & "artist: " & artist & return & "album: " & album & return & "address: " & address buttons {"Ok"}
on error
try
tell current track to display dialog "name: " & name & return & "artist: " & artist & return & "album: " & album & return & "location: " & location buttons {"Ok"}
on error
display dialog "Calamity!"
end try
end try
end tell
Neither of the two scripts worked.
I’m trying to create something similar to this:
I’ve got the top part working (i.e. current song, artist, album and #NowPlaying). I also have Keyboard Maestro to Tweet out the end result of the AppleScript but I can’t get a cover or link to the song on AppleScript. Is this still possible with iTunes and AppleScript? I know that it was possible in the past.
I’ve created the above example with Spotify, Keyboard Maestro and AppleScript but I haven’t been able to do it via iTunes, Keyboard Maestro and AppleScript.
Model: 2009 iMac
AppleScript: 2.10
Browser: Chrome
Operating System: macOS 10.13
tell application "Music" to set anURL to current stream URL