Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

VB script to play a sound file outside FileMaker

Featured Replies

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

  • Author

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

  • Author

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

Anatole

  • Author

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

  • Author

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

  • 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

  • Author

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

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.

  • 4 weeks later...
  • Author

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.

  • Author

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?

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.

  • 3 years later...
  • Author

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!

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.