VoiceGuide IVR Software Main Page
Jump to content

Vbscript In Professional Edition

Recommended Posts

I just purchased your Professional Edition, because I didn't think I needed COM. When I started getting errors saying that COM is not supported, I realized that your code samples showing how to set VBScript return variables (to direct the path of execution) and query for CID when it comes in...all use COM.

 

Surely I don't have to purchase the Enterprise edition to direct which module should execute next from within a VBScript??!? Or do I? Is there some way to do this without the Run_ResultReturn method of the VoiceGuide.CommandLink object?

 

And how would I set up a module to wait until CID is sent, then branch to other modules without the COM object?

 

Please advise.

Share this post


Link to post

From VoiceGuide Help file's section on Run VBScript module:

Once VoiceGuide detects that a VBScript has completed and no COM response was received beforehand then VoiceGuide will see if a "Result File" has been created by the script. If one has been created then VoiceGuide will read in it's contents and then determine what to do next based on the contents of the file.

 

The syntax of the Result File is the same as that used by the Run Program module. The Result Files must be placed in VoiceGuide's data subdirectory. Please refer to the Run Program module Help file's section for more information.

and then if you look in VoiceGuide Help file's section on Run Program module you'll see:

If the 'wait' option is selected then VoiceGuide will pause until the program completes and afterwards VoiceGuide will look for the result file which can be optionally created by the called program. The file can be created in the script's directory, or in the directory where the program was ran from. The file can either be called VGRUNRESULT_LineNumber.TXT or SHLRESLT.TXT

 

If using multiple lines on your system you should adopt the first naming scheme - the LineNumber is the ID of the line which is executing the Run Program module, and it can be passed to your program using the $RV_LINEID Result Variable. This will prevent problems when more then one line tries to execute a Run program module at the same time.

 

The result file can be used to return results back to VoiceGuide. This file should contain the list of the Result Variables that you want VoiceGuide to read in, along with their values.

 

The syntax for the VGRUNRESULT_LineNumber.TXT file is:

 

[Result Variable Name]{Result Variable Value}

 

Multiple Result Variables can be specified. For Example, the following contents:

 

[RvName1]{Value1}[RvName2]{Value2}[RvName3]{Value3}[RvName4]{Value4}

 

Would return 4 Result Variables to VoiceGuide, whose values would be whatever is contained in the curly brackets. All Result Variables must be listed on a single line.

 

There is even a full example in the VoiceGuide Help file, in the Run VBScript module section:

Example 9:

The VBScript below demonstrates how the $RV_LINEID Result Variable is used to generate a Result file from which the data is read back into VoiceGuide. Please note that using the COM function Run_ResultReturn() is a preferable way of returning information to VoiceGuide (it's faster) - but a result file can be used if there is no other way.

 

Dim iIndexDow, iIndexNasdaq, iIndexSP500

 

'Do some work here to retrieve the data and initialize

'the iIndexDow, iIndexNasdaq and iIndexSP500 variables

 

strResultVariables= "[indexDow]{" & iIndexDow & "}" & _

"[indexNasdaq]{" & iIndexNasdaq & "}" & _

"[indexSP500]{" & iIndexSP500 & "}"

 

iRet = WriteResultFile(strResultVariables)

 

Function WriteResultFile(strResult)

  Const ForReading=1, ForWriting=2, ForAppending=8

  filename = "VGRUNRESULT_$RV_LINEID.TXT"

  Set fso = CreateObject("Scripting.FileSystemObject")

  Set ts = fso.OpenTextFile(filename, ForWriting, True)

  ts.WriteLine(strResult)

  ts.Close

  WriteResultFile=0

 

  'always deallocate after use...

  set ts = Nothing

  set fso = Nothing

end function

 

 

It is recommended that the full path to the result file be specified, otherwise the Windows' current 'default' path will be used by the file subsystem - and that does not always point to the same path as the script's.

Share this post


Link to post

Thanks - I thought there must surely be a way to do it.

 

Which Result Variable name should be used to pass return values to the branch logic specified in the Paths tab ("on {a} goto [A], on {b} goto , etc.")?

Share this post


Link to post

If a result file is provided then a Success path is taken.

 

If you want to branch based on the value of Result Variables set in the results file then you should use an Evaluate Expression module...

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
×