VoiceGuide IVR Software Main Page
Jump to content

Run Vbscript: Relative File Path In Opentextfile Function

Recommended Posts

Hi VoiceGuide Team,


Can i use relative file path in OpenTextFile function?

I also try this code but it's fail.


set fso = CreateObject("Scripting.FileSystemObject")
set scriptPath = fso.GetParentFolderName(WScript.ScriptFullName)
set textFilePath = fso.BuildPath(scriptPath, "localinfo.txt")
set fileLocalData = fso.OpenTextFile(textFilePath)
sEntireFile = fileLocalData.ReadAll
set fileLocalData = Nothing
set fso = Nothing
set vg = CreateObject("vgServices.CommandLink")
vg.Run_ResultReturn $RV_LINEID, sEntireFile
set vg = Nothing
Thank you for your support.


Share this post

Link to post

The WScript.ScriptFullName will return the VBScript's script filename, not the VoiceGuide callflow's filename. The VBScript's script filename would be seom temporary filename.

Use Admin_TraceLogAdd call (http://www.voiceguide.com/vghelp/source/html/com_admin_tracelogadd.htm) to display value in vgEngine log file to let you confirm actual value.


The path to VoiceGuide callflow is stored in this $RV:



The above $RV does not include the "\" at the end. (see: http://www.voiceguide.com/vghelp/source/html/resultvariables.htm )


so you can change this line in your VBScript:


set textFilePath = fso.BuildPath(scriptPath, "localinfo.txt")




set textFilePath = fso.BuildPath("$RV_PathScript", "localinfo.txt")

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