VoiceGuide IVR Software Main Page
Jump to content

Activex / Wscript Problem

Recommended Posts

Hello,

We Changed the OS to Windows 2008 Server 32 bit (SP2)

 

After that , Vg fails when reaching " CreateObject("WScript.Shell") " line in our VBScripts

 

According the NOTE event in vgEngine Log file ,

We added this entry to [moduleRunScript] section of VG.INI : Engine=WSH

,but problem wasn't fix.

 

 

Machine info:

Windows 2008 Server 32-bit (SP2)

.NET 4.0

VoiceGuide v7.4.4

D4PCIUFEQEU Dialogic Card

 

File is attached.

Thank you.

 

 

 

Error.zip

Share this post


Link to post

The script in VoiceGuide's "Run VBS" module is:

Option Explicit

Dim vg
Set vg = CreateObject("vgServices.CommandLink")
vg.RvSet $RV_LINEID, "debug_line", "5"
Dim fso , objShell
vg.RvSet $RV_LINEID, "debug_line", "7"
Set fso = CreateObject("scripting.filesystemobject")
vg.RvSet $RV_LINEID, "debug_line", "9"
Set objShell = CreateObject("WScript.Shell")
vg.RvSet $RV_LINEID, "debug_line", "11"

Set fso = nothing    
Set objShell = nothing
vg.Run_ResultReturn $RV_LINEID, "success"
Set vg = Nothing

Why do you need to create the "WScript.Shell" object?

 

Can you post the rest of the script that shows how the WScript.Shell object is then used ?

 

VoiceGuide v7.4.4 uses a different method of running VBScript - which is much faster - but it no longer uses the WScript/CScript to run the scripts in the "Run VBS" modules.

 

 

 

To have system use the old Wscript/CScript way of running the VBScript snippets please set this in VG.INI file, in section [moduleRunScript]

 

Engine=wscript

Share this post


Link to post
Regarding VBS compatibility:

What vbscript Commands / Functions / Objects , can be used in the new VoiceGuide v7.4.4

I would like to get more details, Thanks.


We use the "run" Method in "WScript.Shell" object.

In order to interact with other commands on system and also simplifying various tasks in the vbs code,


Here is an example:

Sorting alphabetically a file list and finding a file that is located before other file




option Explicit
Const ForReading = 1
Dim fso , vg , WshShell , strDirPath ,strCurrentFileName , strCommandOutput , strCommand , strPreviousFileName
set vg = CreateObject("vgServices.CommandLink")
Set fso = WScript.CreateObject("Scripting.Filesystemobject")
Set WshShell = WScript.CreateObject("Wscript.Shell")

strDirPath = "d:\data\"
strCurrentFileName = "$RV[current_file_name]"
strCommandOutput = "d:\temp\command_output.txt"

strCommand = "%comspec% /c Dir /oN /B " & chr(34) & strDirPath & chr(34) & " | grep -B1 " & strCurrentFileName & " | grep -v " & strCurrentFileName & " > " & chr(34) & strCommandOutput & chr(34)
WshShell.Run strCommand,0,True
strPreviousFileName = fso.OpenTextFile (strCommandOutput ,ForReading).ReadLine

vg.RvSet $RV_LINEID, "previous_file_name", strPreviousFileName
...

Share this post


Link to post

Just the WScript object is not available.

 

Please try using:

set objShell = CreateObject("shell.application")
        
objShell.ShellExecute strCommand, "", "", "runas", 0

Please see:

 

http://msdn.microsoft.com/en-us/library/windows/desktop/gg537745%28v=vs.85%29.aspx?cs-save-lang=1&cs-lang=vb#code-snippet-1

 

http://ss64.com/vb/shellexecute.html

 

you could even use shell.application object to start a cscript/wscript intepretor, like this:

 

set objShell = CreateObject("shell.application")

objShell.ShellExecute "cscript", "E:\demo\vbscript.vbs", "", "runas", 0

 

 

 

Setting in VG.INI:

 

[moduleRunScript]

Engine=WScript

 

Note: WScript not WSH

 

should switch system back to using the old WScript way of running the VBS scripts. If you have problems when Engine=WScript is set then please post trace capturing that call

Share this post


Link to post

After switching back to the old WScript way of running the VBS scripts, the scripts are executed by vg.

But it takes a lot time to process each script, comparing the time it took in vg v7.3 (on Win XP)

 

Regarding Using the new way of running the VBS scripts:

Using "Shell.application" Object for running command, How can I wait until the process has finished?

Share this post


Link to post

Setting Engine=WScript should result in the wscript.exe interpreter being used - as in older versions.

 

If you are seeing that the script runs slower then have you tried to use some logging to determine where the script slows down?

 

With Shell.application's ShellExecute command, perhaps you may need to use a loop to check for some file based flag that gets set at end of process called by ShellExecute ? Don't know enough about VBScript to know if that is the best approach or not.

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
×