In the begining I just had my sounds in the resources folder so in my script I was just using set alertSound to load sound “Sound Name” and that was working fine but now I want to put them 1 folder level deeper in a folder called “Alert Sounds” in the “Resources” folder.
Obviously set alertSound to load sound “Sound Name” doesn’t work any more.
So how do I make it look in the “Alert Sounds” folder in the “Resources” folder when doing load sound?
Try something like this:
-- You need to include the file's extension in this one
load sound ((resource path of main bundle) & "Alert Sounds/Sound Name.aiff")
-- or this.However, `path to resource` only works on OS X v10.4 or later
load sound (POSIX path of (path to resource "Sound Name" in directory "Alert Sounds"))
Well I was going for the first one since I know some of my users are on 10.3 and what I have is this…
set soundName to title of popup button “Alert Sounds Menu” of window “Preferences”
(the file type suffix is part of the file name in the menu items in the pop up menu. i.e. “MySound.mp3” would be menu item 1 and so on)
set AlertSound to load sound ((resource path of main bundle) & “Alert Sounds/”) & soundName
And this produces the following error
NSRecieverEvaluationScriptError: 4 (1)
Any Ideas what I’m doing wrong there?