tell application "iTunes"
set the_result to button returned of (display dialog "Selected Track's Radio URL:
" & ((get address of selection) as string) buttons {"Copy selected track's URL", "Export to Text", "Cancel"} default button 1 with icon 1)
if the_result is "Copy selected track's URL" then set the clipboard to address of selection as string
if the_result is "Export to Text" then set myText to address of selection as string
set myDesktop to ((path to desktop folder as text))
set myPath to myDesktop
set myTxtFile to name of selection as string
set fileWrite to open for access myPath & myTxtFile with write permission
write myText to fileWrite
close access fileWrite
if the_result is "Cancel" then close
end tell
how do i make it so that each button does a seperate thing
tell application "iTunes"
activate
try
if selection is {} then error
tell first item of selection
set radioURL to address
set trackName to name
end tell
on error
display dialog "No radio track selected." buttons "Cancel" default button 1 with icon 2
end try
display dialog "Selected track˜s radio URL: " & radioURL buttons {"Cancel", "Export to Text", "Copy URL"} default button 3 with icon 1
set theButton to button returned of result
end tell
if theButton is "Copy URL" then
set the clipboard to radioURL
else if theButton is "Export to Text" then
try
set fileRef to open for access ((path to desktop folder as Unicode text) & trackName & ".txt") with write permission
write radioURL to fileRef
close access fileRef
on error errMsg number errNum
try
close access fileRef
end try
display dialog "Error " & errNum & return & return & errMsg with icon caution buttons {"Cancel"} default button 1
end try
end if