Need help with a Fun little app

OK, so school got macs i been having fun on xcode and apple script, need some help please.

1: can i get appl script to play media from a URL? like play a song?, if so will it play in Back Ground? or In Like iTunes?

2: need help with choices in it, say it pops up in terminal, saying,


say dialog "Welcome, Pick a Song!"
1: song name 1
2:song 2 etc.."

3,
thats about it just a simple script in Terminal, to play songs or get it to sing them in a voice xD

Welcome to MacScripter!

With playing sounds, there are two ways I know of.

The first is a shell command.

do shell script "afplay /Users/Joey/Destop/myAudioFile.aif"

Put the path to the sound as a POSIX path…

set fileWithoutPosix to (choose file with prompt "Choose audio file to play:")

set fileAsPosix to POSIX path of fileWithoutPosix

do shell script "afplay " & quoted form of fileAsPosix 

The other way is to download the application “Play Sound” by clicking here. Drag the application to AppleScript Editor to see its dictionary.

L :slight_smile:

Ty :slight_smile: well so far i have

set theURLs to {"http://www.apple.com", "http://www.apple.com", "http://www.apple.com", "http://www.apple.com", "http://www.apple.com", "http://www.apple.com", "http://www.apple.com", "http://www.apple.com", "http://www.apple.com", "http://www.apple.com"}
display dialog "Pick a number from 1 to 10." default answer ""
try
open location (item (text returned of the result) of theURLs)
on error
display dialog "Invalid number." buttons "OK" default button "OK"
end try

now i need to know how to set it up so that, when they pick it it will say what they picked, separate for each URL selection, a display dialog basically :slight_smile:

You can do that with choose from list

Try:

set chosenURL to (choose from list theURLs) as string
if chosenURL does not equal "false" then open location chosenURL

Choose from list returns false when the user cancels. In this case, since the result of choose from list is being converted to string, false is now “false”.