Me gustaría acceder a las variables origTrack y origPlaylist desde otro AppleScript para poder volver a la pista y la lista de reproducción que se estaban reproduciendo antes de que se ejecutara el primer script.
Esto es lo que tengo en el primer 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
Segundo 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