Jump to content
Sign in to follow this  
Terrible Toll

VB script to play a sound file outside FileMaker

Recommended Posts

I have fallen victim to the QuickTime sound problem with FileMaker crashing when playing sounds in container fields in Windows. There must be a simple way to play sounds outside FileMaker using a VB script. However, my script writing is not very handy - is there a hero out there that might have a quick and dirty script for this ... please!

thanks for any hints help or otherwise

Anatole

Share this post


Link to post
Share on other sites

Right - well I've made a little progress on this front. Not using any VB yet though, but I am sure there are VBwhizzes out there who can make this work really smoothly. By using a Send Event step:

open document event with: Document

file:music/$songname

where $songname is the full name for the songfile (one per record) in my database.

This opens the song in iTunes (transferring it into the iTunes library if it is not already there) and plays it. However, it brings the iTunes application to the foreground. Ideally I would like it to play in the background and not relinquish the control from FileMaker.

Any ideas?

thanks - Anatole

Share this post


Link to post
Share on other sites

OK - I soldier on. Does anybody have any idea why this doesn't work in runtime FileMaker?

Anatole

Share this post


Link to post
Share on other sites

OK I'm trying command line scripting:

Any ideas why this doesn't work?

"

CMD /C/K " &

"START " & "myfolder;" & $filename

Either I have the command coding completely wrong, or I don't understand the path structure properly. $filename is a variable holding the name of the sound file (e.g. "sound.mp3"), so I believe the path for this file should be myfolder;sound.mp3 relative to the database file.

Any hints would be really useful.

Anatole

Share this post


Link to post
Share on other sites

Well, since I didn't have any luck with that and I just seem to be talking to myself here, I've had a go at VBscripting. This is the .vbs file that I output from FileMaker:

' Variables 

dim iTunes, FullPath 

' Get the full path of the file to play 

FullPath = "C:Documents and Settingsuser foldersongfile.mp3" 

' Connect to iTunes app 

set iTunes = CreateObject("iTunes.Application") 

' Play the file 

iTunes.PlayFile FullPath 

' Done; release object 

set iTunes = nothing

This doesn't work either. It triggers iTunes and brings it forward, but won't load or play the songfile. Double clicking on the songfile works fine though. Any comments on this would be seriously appreciated.

Anatole

Share this post


Link to post
Share on other sites

You might try to just open the file with your script instead of tring to script I-tunes.

On windows a file can be done with a Send Event Script Step. Use the path formated like "C:yourpathyourfile.mp3" The operating system should open the Default program for that file type and open/play the file.

Oh and make sure the bring to foreground box is checked.

Edited by Guest

Share this post


Link to post
Share on other sites

That works - although it is still pretty cumbersome playing sounds through iTunes.

Send Event ["aevt";"odoc";"$songname"]

(where $songname is the filename and path of the sound)

Is it possible to do this with QuickTime in a similar manner to the Mac version?

many thanks - Anatole

Share this post


Link to post
Share on other sites

Don't Know but you could try the Open URL where the URL is the path to the file you want to play. That should work on either. (I have not tried this on a mac). That should work as long as your browser can handle the file type you are asking it to open.

Share this post


Link to post
Share on other sites

Thanks but the soundfiles are all in a folder on my computer. It wouldn't be a problem if loading up iTunes didn't take so long and if it would play in the background. The 'bring application to front' option seems to make no difference - it always does.

Share this post


Link to post
Share on other sites

OK - I've now managed to get the sound files opening in QuickTime by changing the 'open with' setting for each sound file to QuickTime.

All I need to do no is get the song to play automatically (if the default is not set to do so in QuickTime) and to run the task in the background. Any ideas anyone?

Share this post


Link to post
Share on other sites

You might look at the registry settings on windows. you might be able to find the setting there. If you can it can be set with a vbs script.

Not sure how you would do it on a mac.

Share this post


Link to post
Share on other sites

You might look at the registry settings on windows. you might be able to find the setting there. If you can it can be set with a vbs script.

Not sure how you would do it on a mac.

Thanks for that.

Of course, on a Mac, it just works. So no issue there!

Share this post


Link to post
Share on other sites
Guest
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×

Important Information

By using this site, you agree to our Terms of Use.