Thanks Christian, I was trying to avoid having to buy plugins. I saw an AVplayer script step, but couldn't figure out how to make it work. For now my clunky script is making it work, just hoping for a little more elegant solution.
If you're on a Mac, you can use a built-in Unix command, afplay, calling via the "do shell script" command with AppleScript.
It runs well, and has a few options. I tend to run it first to "kill" whatever may be already running, or you could end up with both running at once.
Each of the below are running via Perform AppleScript.
do shell script "killall afplay"
set unix_raw_file to cell "File_Path" of current record
set unix_file to quoted form of unix_raw_file
do shell script "afplay -q 1 " & unix_file & " &> /dev/null &"
The last part: & " &> /dev/null &"
is added so it releases FileMaker immediately. It your case you might now want it do that, so you could remove that; it works without it [ I'm not really a Unix guy, so can't tell you how exactly more details about that :-].
I'm reading the Unix file path from a field (as I use this to play songs). In your case you could just add the Unix path manually (as it sounds like there's only one).
You'd need to export the sound file to somewhere like the Temporary folder first. That should not take long with such a small file.
In the Advanced Version you can create Layout Script Trigger….Trigger: Layout load
This Trigger start the Script and your Sound will played.
Thanks Fenton, not much of a Unix guy either but keep meaning to learn it.
Will play around with that and see if I can make it work.
We do analyses and generate technical reports and this is for my "Job Tracking" solution. I have a script that archives the pdf version of the report, attaches it to an email to the customer, then play a little clip (about 12 second .aif file) from a song.
The song part is just for fun.
Actually I'm trying not to make it play when the layout loads, only when a script is executed.
That seems a bit clunkier. The container field method is working. I just formatted the global container field to autoplay then added these to my script.
Go to Field [Soundfield]
Insert Audio/Video[Reference ; "filename.aif"] //container is set to auptoplay
Pause/Resume Script [ Duration (seconds): 15]
Set field [Soundfield ; ""]
As long as the sound file is on the server it works for any user. And since it clears itself out every time it won't play the sound unless the script is run. Am thinking I throw several sound bites in and name them as 1.aif, 2.aif, 3.aif, etc I can add a counter script and have it cycle through several different ones if I wanted.
I was just thinking at first since there was some new (at least to me) AVPlayer script steps that there should have been a way to just play the file using a single step.