Vorrei accedere alle variabili origTrack e origPlaylist da un altro AppleScript in modo da poter tornare alla traccia e alla playlist riprodotte prima dell'esecuzione del primo script.
Ecco cosa ho nel primo script:
global origTrack
global origPlaylist
on run arguments
if ((count of arguments) is 0) or (first item of arguments) is not "paused" then
set origTrack to ""
tell application "iTunes"
if player state is playing then
set origTrack to current track
end if
end tell
set origPlaylist to ""
tell application "iTunes"
if player state is playing or player state is paused then
set origPlaylist to current playlist
set newPlaylist to playlist "Morning Mix"
set view of front window to newPlaylist
end if
end tell
tell application "iTunes" to play newPlaylist
end if
return arguments
end run
Secondo script:
on run
set isPlaying to false
tell application "iTunes"
set isPlaying to player state is equal to playing
pause
set current track to origTrack
end tell
if isPlaying then
return "playing"
else
return "paused"
end if
end run