VoiceGuide IVR Software Main Page
Jump to content

How Best To See If A Wav Exists Before Playing?

Recommended Posts

Hi, probably a stupid question, but what is the best way to detect the presence of a wav file before playing it, and if it is not there, play something else?

 

I guess this needs to be VBScript, open a file object using the wav filespec, if "object is nothing" do something else, then calll vg.Play_Start() etc...

 

A sort of: "if exists(wavA) then playit(wavA) else playIt(wavB)"

 

Just not clear how to do this...!

 

Any help appreciated - thx - Tim.

Share this post


Link to post

Use VBscript to run a "DIR" equivalent command on the file you want to play, and if "DIR" reports that the file is not there then play some other file.

Share this post


Link to post

thx - but can you be a little more explicit?

 

I reckon I need something from FileSystemObject... Do you have anything you can just paste in here?

 

thx - tim

Share this post


Link to post

Found something here...

 

Function ReportFileStatus(filespec)

Dim fso, msg

Set fso = CreateObject("Scripting.FileSystemObject")

If (fso.FileExists(filespec)) Then

msg = filespec & " exists."

Else

msg = filespec & " doesn't exist."

End If

ReportFileStatus = msg

End Function

 

Should be able to work it out from here - thx - tim.

Share this post


Link to post

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
×