VoiceGuide IVR Software Main Page
Jump to content

Read From Txt File

Recommended Posts

I was able to write to a file and I want to read the the info from the file back. I have VB script with this code: The file that I want to read from has one line in it.

 

set fso = CreateObject("Scripting.FileSystemObject")

set fileV = fso.OpenTextFile("C:\emailaddress3.txt",ForReading)

sEntireFile = fileV.ReadAll

fileV.close

 

set vg = CreateObject("VoiceGuide.CommandLink")

vg.RvSet $RV_LINEID, "EmailAddress", sEntireFile

set vg = Nothing

set fileV = Nothing

set fso = Nothing

 

From this code the result of $RV[EmailAddress] ="" instead of the line from the file. Do you see anything wrong with this code?

 

Thanks

Share this post


Link to post

You would have gotten an error displayed on screen when you ran that VBScript telling you which line is incorrect... this line is wrong:

 

set fileV = fso.OpenTextFile("C:\emailaddress3.txt",ForReading)

 

You are using "ForReading" constant - but have not declared what this constant ought to be (VBScript engine will not declare this constant for you internally).

 

Use this:

 

set fileV = fso.OpenTextFile("C:\emailaddress3.txt", 1)

 

and all should work OK.

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
×