Jump to content

VB script to play a sound file outside FileMaker


This topic is 4695 days old. Please don't post here. Open a new topic instead.

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

Link to comment
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

Link to comment
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

Link to comment
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

Link to comment
Share on other sites

  • 3 weeks later...

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
Link to comment
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

Link to comment
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.

Link to comment
Share on other sites

  • 4 weeks later...

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.

Link to comment
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?

Link to comment
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.

Link to comment
Share on other sites

  • 3 years later...

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!

Link to comment
Share on other sites

This topic is 4695 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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