VoiceGuide IVR Software Main Page
Jump to content

Vbscript

Recommended Posts

hello,

bellow is my VBScript that I try to run it with my VG. the problem is, the VBScript module keep running until phone disconnected.

 

would you please take a look at it an let me know why I don't get any result from it? this VBS works fine with compiler.

 

Thanks

 

Function dbconnection()

Dim ConnProviderName

Dim ConnDBFile

Dim ConnDBFolder

Dim ConnUserName

Dim ConnPassword

Dim ConnOption

ConnProviderName = "Microsoft.Jet.OLEDB.4.0"

ConnDBFile = "IVR_Announcement.mdb"

ConnDBFolder = ""

ConnUserName = ""

ConnPassword = ""

ConnOption = "Persist Security Info=False"

' Connect from ASP page use this Connect_String

Connect_String = "Provider=" & ConnProviderName & ";User ID=" & ConnUserName & ";Password=" & ConnPassword & ";Data Source=" & Server.MapPath(ConnDBFolder & ConnDBFile) & ";" & ConnOption

 

' Connect from other sources use this Connect_String

' Connect_String = "Provider=" & ConnProviderName & ";User ID=" & ConnUserName & ";Password=" & ConnPassword & ";Data Source=E:\Other\IVR\IVR_Announcement.mdb;" & ConnOption

 

 

Dim MyConn ' Database connection object

dbconnection = Connect_String

End Function

 

Sub GetAccessRecord()

 

 

Call GetCalendarRecordByCalledId("esa tara")

 

 

End Sub

 

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

 

Sub GetCalendarRecordByCalledId(CallerId)

' this function will select the record from calendar table based on CallerId Provided.

 

Dim Company_name

Dim Client_name

Dim Announcement_Date

Dim Announcement_Time

Dim Client_Phone

Dim File_Name

Dim Office_Email

Dim Announce_Status

 

 

Dim MyConn

Dim ResultSet

Dim Sql

MsgBox CallerId

 

' If you use this script from ASP page, use this funtion

Set MyConn = Server.CreateObject("ADODB.Connection")

 

' If you use this script from Macro, use this funtion

'Set MyConn = CreateObject("ADODB.Connection")

 

' If you use this script from ASP page, use this funtion

Set ResultSet = Server.CreateObject("ADODB.Recordset")

 

' If you use this script from Macro, use this funtion

'Set ResultSet = CreateObject("ADODB.Recordset")

 

Dim Connection_string

Connection_string = dbconnection()

MyConn.Open Connection_string

 

If Err <> 0 Then

MsgBox "Error occured in Connection"

End If

 

Sql = "select * from calendar where CallerId & "4085555555"

 

ResultSet.Open Sql, MyConn

 

If Err <> 0 Then

MsgBox "Error Occured in Sql Query"

Else

Do While Not ResultSet.EOF

Company_name = ResultSet("Company_Name")

Client_name = ResultSet("Client_name")

Announcement_Date = ResultSet("Announcement_Date")

Announcement_Time = ResultSet("Announcement_Time")

Client_Phone = ResultSet("Client_Phone")

File_Name = ResultSet("File_Name")

Office_Email = ResultSet("Office_Email")

Announce_Status = ResultSet("Announce_Status")

 

'MsgBox Company_name & Client_name & Announcement_Date & Announcement_Time & Client_Phone & File_Name & Office_Email & Announce_Status

'Move to the next record in the recordset

ResultSet.MoveNext

Loop

End If

 

ResultSet.Close

Set ResultSet = Nothing

MyConn.Close

Set MyConn = Nothing

 

End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

 

set vg = CreateObject("VoiceGuide.CommandLink")

vg.Run_ResultReturn $RV_LINEID, "[CN]{"Company_name"}[CLN]{"Client_nam"}"

set vg = Nothing

Set client = Nothing

 

 

 

Share this post


Link to post

Best way to debug VBScripts which are running from within VoiceGuide's Run VBScript module is to make calls to Admin_TraceLogAdd COM function throughout the VBScript. The Admin_TraceLogAdd entries are printed in the vgEngine log and you will then be able to look through the vgEngine log to track how the script executes and identify at what lines the script has any problems.

Share this post


Link to post

Also the expression returned by the vg.Run_ResultReturn function is an invalid expression.

 

In quotes script you have:

 

vg.Run_ResultReturn $RV_LINEID, "[CN]{"Company_name"}[CLN]{"Client_nam"}"

 

it should be something more like:

 

vg.Run_ResultReturn $RV_LINEID, "[CN]{" & Company_name & "}[CLN]{" & Client_nam & "}"

 

VBScript uses & to concatenate strings together.

 

 

 

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
×