VoiceGuide IVR Software Main Page
Jump to content

Loop Playing Sound

Recommended Posts

Dear Sir,

 

I'm create vbscript module to connect to database, I need create loop inside that VBScript module to get the sound file name form the database recordset and play it in the Play module then back again to the VBScript to get the second sound file name and play in the Play module and so on until the last record in the recordset.

 

thanks

Share this post


Link to post

I mean:

Const adOpenStatic = 3

 

set vg = CreateObject("VoiceGuide.CommandLink")

set cn = CreateObject("ADODB.Connection")

set rs = CreateObject("ADODB.Recordset")

cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\data\Ads.mdb"

 

if cn.State = 1 then

set rs.ActiveConnection = cn

rs.Open "SELECT TOP 1 NameField FROM AdList ", cn, adOpenStatic

while Not rs.EOF then

sNameField = rs.Fields("NameField").Value

' #####################################################

' I need put script here to branch to "Play module"

' then speak the value of variable 'sNameFiled' that is I get it from database,

' after the "Play module" finished from 'text to speak', back again to this script

' then take the next value of the variable 'sNameField' to "Play module' for

' speak it as 'text to speak'.. and so on, until finish from all records I get it

' from database. (speak all result I get it from database one by one)

' #####################################################

end if

end if

 

cn.Close

Set rs = Nothing

Set cn = Nothing

Set vg = Nothing

Share this post


Link to post

No need to use VBScript for a simple loop like that.

See attached script for an example of how to do this.

 

(nb. script was not tested but it should be pretty close to the mark)

play_list_from_db.vgs

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
×