Hi,
How do I play system sounds?
Folder ~/Library/Sounds is empty.
Thanks
Funny… Go to → Library
Finder opens the Library folder and indead it is empty.
Search “Sounds”, and one entry (son of Library) displays… sounds (14 items):
The answer is…
One Sounds folder is in the Users:Library folder,
the other is in System:Library folder…
Compare with the above screen shot:
I put this code (from the documentation, except the first line):
Var soundFile As FolderItem = Folderitem.ShowOpenFileDialog("")
If soundFile.Exists Then
Try
Var tada As Sound = Sound.Open(soundFile)
tada.Play
Catch error As IOException
MessageBox("The sound file could not be opened. Error: " + error.Message)
End Try
End If
Run, then click in the button and choose a sound from HD:System:Library:Sounds/
NB: do not use the “Users:Library:Sounds:” folder… excepted if you place sounds there…
Thanks. I tried this:
Function PlaySound(soundFile As String)
Var f As FolderItem = SpecialFolder.System.Child("Library").Child("Sounds").Child(soundFile)
If f <> Nil And f.Exists Then
Try
Var s As Sound
s = s.Open(f)
s.Play
Catch error As IOException
MessageBox("The sound file could not be opened. Error: " + error.Message)
End Try
End If
Hi,
What sound system would you use to illustrate a successful operation and a failure/error?
Hi All,
Does this also work for web apps?
Tim
None.
If your web app runs on a Mac OS X server, yes. Otherwise, the path won’t exist.