Hi friends,
important facts:
1. internally LC uses the SLASH as a path delimiter on ANY platform!
2. LC only supports UNCOMPRESSED AIF and WAV files and the compressed AU format with the PLAY command.
I want to select the wav file from a textfield, option field or preferably with an os 'open file' dialog.
So you want to click a line in a list field which hoilds all sounds in a folder and player that sound?
OK, set up a list field and fill it with sounds from a folder:
Code: Select all
...
## Ask user to select a folder:
answer folder "Select a folder with sound files!"
put it into tSoundFolder
## Put files in that folder into a variable:
put files(tSoundFolder) into Files
## Only let WAV files get through
filter tFiles with "*.wav"
## Create FULL path to files:
repeat for each line tFile in tFiles
put tSoundFolder & "/" & tFile & CR after tNewFIleList
end repeat
## Delete trailing CR in new list
delete char -1 of tNewFIleList
## Put into field:
put tNewFIleList into fld "your list field here"
...
And the script for your list field:
Code: Select all
on mouseup
put the selectedtext of me into tFileToPlay
## Always check everything
if there is a file tFileToPlay then
play ac tFileToPlay
end if
end mouseup
Hope that helps.
Best
Klaus