Hi ctflatt,
It depends a little how you want to add your folders with the sound file. Lets assume you want to include them with your program by choosing in the standaloen application settings-> copy files ->add folder.
Then on a Mac this folder is in the app bundle next to the tempPlayer. This is the name I gave the test stack. And I saved the standalone to the desktop in a folder that has the same as the app name (this is all automatically done by Livecode once you point it to a destination folder when building the standalone
/Users/userName/Desktop/tempPlayer/tempPlayer.app/Contents/MacOS/tempPlayer
this is what "the effective filename of this stack" returns.
If you include a folder in the above way it will be at the level of your app in the above path or, the other way around in
/Users/userName/Desktop/tempPlayer/tempPlayer.app/Contents/MacOS/tempPlayer
folder
This is what you get if you issue a
Code: Select all
put item 1 to -2 of the effective filename of this stack into tPath
tPath would contain the path to the folder your folder with subfolder is in.
From there it should be easy to go on. In my templayer test I set a custom property "uPathToFolderOfMyFolder" of the stack on openstack
Code: Select all
on openstack
set the itemDelimiter to "/"
put item 1 to -2 of the effective filename of this stack into tPath
set the uPathToFolderOfmyFolder of this stack to tPath
end openstack
in a mouseUp button I then have:
Code: Select all
if not exists (player "myTempPlayer") then
reset templateplayer
set the visible of the templateplayer to false
set the name of templatePlayer to "myTempPlayer"
create player
end if
put the uPathToFolderOfmyFolder of this stack into tFolder
put tFolder & "/" & "english/" & "nameOfYourMP3here.mp3" into tmyPath
set the filename of player "myTempPlayer" to tmyPath
start player "myTempPlayer"
another button to stop the player
Code: Select all
on mouseUp
stop player "myTempPlayer"
end mouseUp
since the players are created in a standalone, they will not be saved and will be recreated on the fly the next time you start your program.
This is not best practice, this is quick and dirty and you have to see how it works. Of course better practice would be what you said: create a player permanently and change the script of the buttons.
You could write a script that extracts the filename and foldername from the button script and replace this with the above script and inserting a folder file automatically. If you attempt this you would want to do it on a copy of your stack.
For windows the path to the included folders might be a little different, so someone would have to add that information. Here are some informations pertaining to the paths
http://lessons.runrev.com/spaces/lesson ... nd-Windows
So actually it all depends how much time and effort you want to put into this. It is really not that difficult.
Kind regards
Bernd