I'm trying to make an app that when opened will play an audio file that is contained in the app, but i have no idea how to do it. I know this is really vague and I apologize but any help would be awesome.
This other question covers high level how to make an app, but I can't figure how to actually make the shell.
Is there a guide or sample code to show how to take an actual file and actually play it in AppleScript framework?
Best Answer
Here is an example of one way to achieve your goal:
In Script Editor, I used the following three lines of code and saved it as an application, as Hello World.app:
Then inside the application bundle in the
Resources
folder, I placed the audio file Hello World.aiff, which is a file of someone saying "hello world".Here is a tree view of the hierarchal structure of the application bundle:
Now when I double-click on the Hello World.app is plays the Hello World.aiff audio file.
Notes:
After you create the application bundle, then in Finder you right-click on it selecting Show Package Contents and then navigate to the Resources folder where you'll place your audio file.
Change the name of the
resourceName
from"Hello World.aiff"
, to whatever your audio file name is, in the example code so it will work for your filename.