VoiceGuide IVR Software Main Page
Jump to content

Vbs Script Examples

Recommended Posts

Hi, i need an example of a vbs script that wil query a dbase3 database and return the results to voiceguide to be read back to the caller.Any help would be greatly appreciated.

Share this post


Link to post

Here are a few useful links:

 

HOW TO: Use Jet OLE DB Provider 4.0 to Connect to ISAM Databases

http://support.microsoft.com/kb/326548

 

and:

http://www.voiceguide.com/vghelp/source/html/modvbs.htm

 

eg:

 

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=c:\somepath;Extended Properties=DBASE III;"

 

if cn.State <> 1 then

vg.Admin_TraceLogAdd iLineId, 5, "login connection to database could not be made"

vg.Run_ResultReturn iLineId, "fail"

WScript.Quit

end if

 

set rs.ActiveConnection = cn

sSQL = "SELECT TOP 1 AdID, Filename, PlayCount, LastPlayTime FROM AdList WHERE PlayCount < PlayCountMax AND Active <> 0 ORDER BY LastPlayTime"

rs.Open sSQL, cn, 3

 

if rs.RecordCount <= 0 then

rs.Close

vg.Admin_TraceLogAdd iLineId, 5, "no records retrieved"

else

iAdID = rs.Fields("AdID").Value

sFilename = rs.Fields("Filename").Value

iPlayCount = rs.Fields("PlayCount").Value

dateLastPlayTime = rs.Fields("LastPlayTime").Value

rs.Close

 

strResultVars= "[Filename]{" & sFilename & "}[LastPlayTime]{" & dateLastPlayTime & "}"

vg.Run_ResultReturn $RV_LINEID, strResultVars

end if

 

cn.Close

set rs = Nothing

set cn = Nothing

set vg = Nothing

 

And you can then use $RV[Filename] and $RV[LastPlayTime] in the VoiceGuide script.

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
×