VoiceGuide IVR Software Main Page
Jump to content

From Text File To Variable

Recommended Posts

I would like to read 1 word from my text file.

Then I would like to insert the content of that file into the variable

$RV_VarTXT and have it accessible from other modules.

How do I go about that?

 

Thank you

Share this post


Link to post

I used the following script in "VBS" module.

 

 

set fso = CreateObject("Scripting.FileSystemObject")

set fileV = fso.OpenTextFile("X:\VarJobOffers.txt", 1)

 

sEntireFile = fileV.ReadAll

fileV.close

 

set vg = CreateObject("VoiceGuide.CommandLink")

vg.RvSet $RV_LINEID, "Job_Offers", sEntireFile

set vg = Nothing 'always deallocate after use...

set fileV = Nothing 'always deallocate after use...

set fso = Nothing

 

 

In next module "f(x)"

I was trying to acces $RV[Job_Offers] variable but it is empty even that

that VarJobOffers.txt is not empty.

 

What am I doing wrong here.

The script cannot find file $RV[Job_Offers].wav

IHelp please. t drives me crazy.

 

 

 

211159.31 5 linedevstate 2048 0 0

211159.31 5 callstate OFFERING 65962 0 4

211159.31 5 Answer the call at 5/10/2004 9:11:59 PM

211159.33 5 lineAnswer(65962) => 65945

211159.33 5 callinfo CALLEDID

211159.33 5 callinfo ORIGIN

211159.33 5 ring 0

211159.88 5 callstate CONNECTED 65962,1,0

211159.88 5 WorkingModeTAPI@Connected=

211159.88 5 WorkingModeScript@Connected=

211159.91 5 Inband detection not enabled

211159.91 5 StartLoadedVgs at 5/10/2004 9:11:59 PM

211159.91 5 AddRVns [scriptsPath]{X:\}

211159.91 5 rv add [$RV_STARTTIME]{5/10/2004 9:11:59 PM}

211159.91 5 rv add [$RV_DEVICEID]{5}

211159.91 5 rv add [$RV_CIDNAME]{}

211159.91 5 AddRVns [PathApp]{C:\Program Files\VoiceGuide\}

211159.91 5 rv add [$RV_CIDNUMBER]{}

211159.91 5 tapi Reply (LineEvReply) ok 65945 0

211159.91 5 callinfo MONITORMODES

211159.91 5 TimeoutClear

211159.91 5 [Play 1] Playing

211159.92 5 [Play 1] Playing (1\Welcome.wav)

211159.94 5 PlaySoundStart ok [X:\1\Welcome.wav]

211159.94 5 TimeoutClear

211159.94 5 RunModule PLAY end

211159.94 5 wa(2980,46959300)

211159.94 5 callinfo MONITORMODES

211202.94 5 wb(46959300)

211202.98 5 Play End line[5] (id=469593)

211202.98 5 ScriptEventCode 8001 iLineState=1100

211202.98 5 LsPlayMsg EV_PLAY_FINISHED

211202.98 5 TimeoutSet 10 EV_TIMEOUT_HANGUP

211202.98 5 TimeoutSet 0 EV_TIMEOUT_GOTOMODULE

211202.98 5 ScriptEventCode 9002 iLineState=1101

211202.98 5 LsPlayMsgFinished EV_TIMEOUT_GOTOMODULE

211202.98 5 TimeoutClear

211202.98 5 [iD_TimeDate_Script] Running VB Script...

211203.02 5 VBScript Run continuing...

211203.02 5 TimeoutClear

211203.02 5 [Lng_Choice] Playing

211203.02 5 [Lng_Choice] Playing (1\Pause0_5.wav,1\Lng_Choice.wav,1\Hear_Again.wav)

211203.03 5 PlaySoundStart ok [X:\1\Pause0_5.wav,X:\1\Lng_Choice.wav,X:\1\Hear_Again.wav]

211203.03 5 TimeoutClear

211203.03 5 RunModule PLAY end

211203.03 5 wa(6647,47268702)

211203.03 5 callinfo MONITORMODES

211206.17 5 dtmf 1 (65962,49,2)

211206.17 5 ScriptEventCode 49 iLineState=1100

211206.17 5 LsPlayMsg 1

211206.23 5 PlaySoundStop err=0

211206.23 5 rv add [Lng_Choice]{1}

211206.23 5 TimeoutClear

211206.23 5 [script_Lng_Choice] Running VB Script...

211206.23 5 RVreplace start (strlen>500)

211206.23 5 RVns [PathSysVoice]{}[PathApp]{C:\Program Files\VoiceGuide\}[PathDataVm]{C:\Program Files\VoiceGuide\data\}[PathVgSys]{C:\Program Files\VoiceGuide\system\}[scriptsPath]{X:\}[$RV_STARTTIME]{5/10/2004 9:11:59 PM}[$RV_DEVICEID]{5}[$RV_CIDNAME]{}[PathApp]{C:\Program Files\VoiceGuide\}[$RV_CIDNUMBER]{}[Lng_Choice]{1}

211206.25 5 VBScript Run continuing...

211206.25 5 TimeoutClear

211206.25 5 [Evaluate_Lng] Evaluate [$RV[Lng_Choice]]

211206.25 5 RVreplace start: [$RV[Lng_Choice]]

211206.25 5 RVns [PathSysVoice]{}[PathApp]{C:\Program Files\VoiceGuide\}[PathDataVm]{C:\Program Files\VoiceGuide\data\}[PathVgSys]{C:\Program Files\VoiceGuide\system\}[scriptsPath]{X:\}[$RV_STARTTIME]{5/10/2004 9:11:59 PM}[$RV_DEVICEID]{5}[$RV_CIDNAME]{}[PathApp]{C:\Program Files\VoiceGuide\}[$RV_CIDNUMBER]{}[Lng_Choice]{1}

211206.25 5 RVreplace end: [1]

211206.25 5 .Eval(1)

211206.25 5 AddRVns [Evaluate_Lng_Input]{1}

211206.25 5 AddRVns [Evaluate_Lng]{1}

211206.25 5 Eval Expr result:[1]

211206.27 5 TimeoutClear

211206.27 5 [setLanguage_English] Evaluate ["C:\Program Files\VoiceGuide\system\voice"]

211206.27 5 .Eval(Cstr("C:\Program Files\VoiceGuide\system\voice"))

211206.27 5 AddRVns [setLanguage_English_Input]{"C:\Program Files\VoiceGuide\system\voice"}

211206.27 5 AddRVns [setLanguage_English]{C:\Program Files\VoiceGuide\system\voice}

211206.27 5 AddRVns [DIRSYSTEMVOICE]{C:\Program Files\VoiceGuide\system\voice}

211206.27 5 Eval Expr result:[C:\Program Files\VoiceGuide\system\voice] stored in $RV[DIRSYSTEMVOICE]

211206.27 5 path {C:\Program Files\VoiceGuide\system\voice} not found

211206.27 5 stack idx=1

211206.27 5 rv add [scriptStart_Time]{5/10/2004 9:12:06 PM}

211206.27 5 rv add [scriptStart_CalledFrom_Script]{X:\Start.vgs}

211206.27 5 rv add [scriptStart_CalledFrom_Module]{SetLanguage_English}

211206.27 0 Script Load X:\Options.vgs

211206.30 5 Loaded X:\Options.vgs into:2

211206.30 5 AddRVns [scriptsPath]{X:\}

211206.30 5 TimeoutClear

211206.30 5 [Options] Playing

211206.30 5 RVreplace start: [$RV[Lng_Choice]\Pause0_5.wav,$RV[Lng_Choice]\Pause0_5.wav,$RV[Lng_Choice]\Register.wav,$RV[Lng_Choice]\Options.wav,$RV[Lng_Choice]\Pause0_5.wav,$RV[Lng_Choice]\$RV[Job_Offers].wav,$RV[Lng_Choice]\Hear_Again.wav]

211206.30 5 RVns [PathSysVoice]{}[PathApp]{C:\Program Files\VoiceGuide\}[PathDataVm]{C:\Program Files\VoiceGuide\data\}[PathVgSys]{C:\Program Files\VoiceGuide\system\}[scriptsPath]{X:\}[$RV_STARTTIME]{5/10/2004 9:11:59 PM}[$RV_DEVICEID]{5}[$RV_CIDNAME]{}[PathApp]{C:\Program Files\VoiceGuide\}[$RV_CIDNUMBER]{}[Lng_Choice]{1}[Evaluate_Lng_Input]{1}[Evaluate_Lng]{1}[setL

nguage_English_Input]{"C:\Program Files\VoiceGuide\system\voice"}[setLanguage_English]{C:\Program Files\VoiceGuide\system\voice}[DIRSYSTEMVOICE]{C:\Program Files\VoiceGuide\system\voice}[scriptStart_Time]{5/10/2004 9:12:06 PM}[scriptStart_CalledFrom_Script]{X:\Start.vgs}[scriptStart_CalledFrom_Module]{SetLanguage_English}[scriptsPath]

X:\}

211206.30 5 RVreplace end: [1\Pause0_5.wav,1\Pause0_5.wav,1\Register.wav,1\Options.wav,1\Pause0_5.wav,1\.wav,1\Hear_Again.wav]

211206.31 5 [Options] Playing (1\Pause0_5.wav,1\Pause0_5.wav,1\Register.wav,1\Options.wav,1\Pause0_5.wav,1\.wav,1\Hear_Again.wav)

211206.31 5 File not found [1\.wav]

211206.31 5 PlaySoundStart ok [X:\1\Pause0_5.wav,X:\1\Pause0_5.wav,X:\1\Register.wav,X:\1\Options.wav,X:\1\Pause0_5.wav,C:\Program Files\VoiceGuide\system\voice\SoundFileNotFound.wav,X:\1\Hear_Again.wav]

211206.31 5 TimeoutClear

211206.31 5 RunModule PLAY end

211206.31 5 wa(14428,47598406)

211206.33 5 callinfo MONITORMODES

211220.77 5 wb(47598406)

211220.81 5 Play End line[5] (id=475984)

211220.81 5 ScriptEventCode 8001 iLineState=1100

211220.81 5 LsPlayMsg EV_PLAY_FINISHED

211220.81 5 TimeoutSet 6 EV_TIMEOUT_REPLAYMSG

211227.30 5 Timer fired EV_TIMEOUT_REPLAYMSG

211227.30 5 ScriptEventCode 9005 iLineState=1101

211227.30 5 LsPlayMsgFinished EV_TIMEOUT_REPLAYMSG

211227.30 5 RVreplace start: [$RV[Lng_Choice]\Pause0_5.wav,$RV[Lng_Choice]\Pause0_5.wav,$RV[Lng_Choice]\Register.wav,$RV[Lng_Choice]\Options.wav,$RV[Lng_Choice]\Pause0_5.wav,$RV[Lng_Choice]\$RV[Job_Offers].wav,$RV[Lng_Choice]\Hear_Again.wav]

211227.30 5 RVns [PathSysVoice]{}[PathApp]{C:\Program Files\VoiceGuide\}[PathDataVm]{C:\Program Files\VoiceGuide\data\}[PathVgSys]{C:\Program Files\VoiceGuide\system\}[scriptsPath]{X:\}[$RV_STARTTIME]{5/10/2004 9:11:59 PM}[$RV_DEVICEID]{5}[$RV_CIDNAME]{}[PathApp]{C:\Program Files\VoiceGuide\}[$RV_CIDNUMBER]{}[Lng_Choice]{1}[Evaluate_Lng_Input]{1}[Evaluate_Lng]{1}[setL

nguage_English_Input]{"C:\Program Files\VoiceGuide\system\voice"}[setLanguage_English]{C:\Program Files\VoiceGuide\system\voice}[DIRSYSTEMVOICE]{C:\Program Files\VoiceGuide\system\voice}[scriptStart_Time]{5/10/2004 9:12:06 PM}[scriptStart_CalledFrom_Script]{X:\Start.vgs}[scriptStart_CalledFrom_Module]{SetLanguage_English}[scriptsPath]

X:\}

211227.30 5 RVreplace end: [1\Pause0_5.wav,1\Pause0_5.wav,1\Register.wav,1\Options.wav,1\Pause0_5.wav,1\.wav,1\Hear_Again.wav]

211227.30 5 [Options] Playing (1\Pause0_5.wav,1\Pause0_5.wav,1\Register.wav,1\Options.wav,1\Pause0_5.wav,1\.wav,1\Hear_Again.wav)

211227.30 5 File not found [1\.wav]

211227.31 5 PlaySoundStart ok [X:\1\Pause0_5.wav,X:\1\Pause0_5.wav,X:\1\Register.wav,X:\1\Options.wav,X:\1\Pause0_5.wav,C:\Program Files\VoiceGuide\system\voice\SoundFileNotFound.wav,X:\1\Hear_Again.wav]

211227.31 5 TimeoutClear

211227.31 5 wa(14428,49696806)

211227.31 5 callinfo MONITORMODES

211234.17 0 sys cleanup Start

211234.17 0 sys cleanup End

211241.75 5 wb(49696806)

211241.80 5 Play End line[5] (id=496968)

211241.80 5 ScriptEventCode 8001 iLineState=1100

211241.80 5 LsPlayMsg EV_PLAY_FINISHED

211241.80 5 TimeoutSet 10 EV_TIMEOUT_HANGUP

211241.80 5 TimeoutSet 7 EV_TIMEOUT_GOTOMODULE

Share this post


Link to post

Please post the script you are using as well.

 

Looking at the trace I don't think your VG Script is set up to call the module in which you dothe setting of the $RV[Job_Offers]....

Share this post


Link to post

Version=5.0

DefaultModuleDisplayHeight=

StartModule=Job_Offers

RunAtHangup=

StartWithoutAnswer=0

CtmAsiName=

 

[Options]

Type=Play

DispSize=69

Txt=Play a sound file, then await a response...

PlayFile1=$RV[Lng_Choice]\Pause0_5.wav,$RV[Lng_Choice]\Pause0_5.wav,$RV[Lng_Choice]\Register.wav,$RV[Lng_Choice]\Options.wav,$RV[Lng_Choice]\Pause0_5.wav,$RV[Lng_Choice]\$RV[Job_Offers].wav,$RV[Lng_Choice]\Hear_Again.wav

Replay=1,6

strTtsText=

on {1} goto [script_Options]

on {2} goto [script_Options]

on {3} goto [script_Options]

on {4} goto [invalid_No]

on {5} goto [invalid_No]

on {6} goto [invalid_No]

on {7} goto [invalid_No]

on {8} goto [invalid_No]

on {9} goto [invalid_No]

on {*} goto [invalid_No]

on {#} goto [invalid_No]

on {0} goto [Repeat_Options]

on {timeout 7} goto [Hangup_Msg]

 

Position=28,112

 

[script_Options]

Type=Run VB Script

DispSize=69

Txt=Run a VB Script.

VbsFileToRun=

VbsWait=0

VbScript=Dim xlApp, xlBook, xlSht

Dim filename, value1, value2, value3, value4

 

on error resume next

 

filename = "X:\CarFile.xls"

 

Set xlApp = CreateObject("Excel.Application")

set xlBook = xlApp.WorkBooks.Open(filename)

set xlSht = xlApp.activesheet

 

xlApp.DisplayAlerts = False

 

Call GetToFirstItem(xlSht, 1, "ID")

'Call GetToFirstItem(Sheets("Sheet1"), 1, "ID")

 

 

xlBook.Save

xlBook.Close SaveChanges=True

xlApp.Close

xlApp.Quit

 

'always deallocate after use...

set xlSht = Nothing

Set xlBook = Nothing

Set xlApp = Nothing

 

 

Sub GetToFirstItem(wkSheet, iColumn, ColumnStartCaption)

 

wkSheet.Select

 

'Range(iColumn & "1").Select

'wkSheet.Range("A1").Select

 

y = 0

Dim temp

 

Do Until temp = ColumnStartCaption

y = y + 1

temp = wkSheet.Cells(y, iColumn)

Loop

 

y = y + 1

temp = wkSheet.Cells(y, iColumn)

 

Do Until temp = ""

y = y + 1

temp = wkSheet.Cells(y, iColumn)

Loop

 

'write data into the spreadsheet

 

'wkSheet.Cells(y-1, iColumn+1) = $RV[Options]

 

If ($RV[Options]=1) Then

wkSheet.Cells(y - 1, iColumn + 5) = "Register"

ElseIf ($RV[Options]=2) Then

wkSheet.Cells(y - 1, iColumn + 5) = "Leave Msg"

ElseIf ($RV[Options]=3) Then

 

wkSheet.Cells(y - 1, iColumn + 5).Font.Color = RGB(0,0,0) 'works

wkSheet.Cells(y - 1, iColumn + 5).Font.Bold = False 'works

 

'wkSheet.Cells(y - 1, iColumn + 5).Borders.Color = RGB(255,0,0) 'works

'wkSheet.Cells(y - 1, iColumn + 5).Interior.Color = RGB(255,0,0) 'works - sets background color

wkSheet.Cells(y - 1, iColumn + 5).Font.Color = RGB(255,0,0) 'works

'wkSheet.Cells(y - 1, iColumn + 5).Font.Size = 10 'works

wkSheet.Cells(y - 1, iColumn + 5).Font.Bold = True 'works

'wkSheet.Cells(y - 1, iColumn + 5) = "Listen Job Offers"

 

 

wkSheet.Cells(y, iColumn + 5).Font.Bold = $RV[Job_Offers]

 

Else wkSheet.Cells(y - 1, iColumn + 5) = "Disconnect"

End If

 

 

 

End Sub

 

VbsHoldPlay=

on {success} goto [Evaluate]

on {fail} goto [Evaluate]

on {timeout 0} goto [Evaluate]

 

Position=35,345

 

[invalid_No]

Type=Play

DispSize=69

Txt=Play a sound file, then await a response...

PlayFile1=$RV[Lng_Choice]\Invalid_Selection.wav

Replay=0,0

strTtsText=

on {timeout 0} goto [Options]

 

Position=290,107

 

[Repeat_Options]

Type=Play

DispSize=69

Txt=Play a sound file, then await a response...

Replay=0,0

strTtsText=

on {timeout 0} goto [Options]

 

Position=164,242

 

[Evaluate]

Type=Evaluate

DispSize=69

Txt=Evaluate the Result Variable specified, and select the path which matches the current value of the Result Variable

Expression=$RV[Job_Offers]

ExprNewRV=

ExprStoreRV=0

on {true} goto [Evaluate_JO_YES]

on {false} goto [Evaluate_JO_NO]

 

Position=35,456

 

[Hangup the Call]

Type=Hangup the Call

DispSize=69

Txt=Hangup the call.

 

Position=564,453

 

[Hangup_Msg]

Type=Play

DispSize=69

Txt=Play a sound file, then await a response...

PlayFile1=$RV[Lng_Choice]\Hangup_Msg.wav

Replay=0,0

strTtsText=

on {timeout 0} goto [Hangup the Call]

 

Position=569,321

 

[Leave_Msg]

Type=Play

DispSize=69

Txt=Play a sound file, then await a response...

PlayFile1=$RV[Lng_Choice]\Pause0_5.wav,$RV[Lng_Choice]\Leave_Msg.wav,$RV[Lng_Choice]\Pause0_5.wav,$RV[Lng_Choice]\Pound_Finish.wav,$RV[Lng_Choice]\Pound_Sign.wav,$RV[Lng_Choice]\Pause0_5.wav,$RV[Lng_Choice]\Pause0_5.wav

Replay=0,0

strTtsText=

on {timeout 0} goto [Record_Msg]

 

Position=227,680

 

[Record_Msg]

Type=Record

DispSize=69

Txt=Record a sound file, and go down different paths depending on what digit was pressed to terminate recording...

RecFile=MWC_GeneralMsg\$RV[EnterPhone]Date$RV_MONTH_$RV_DATETime$RV_HOUR_$RV_MINUTE.wav

PlayTone=ON

on {timeout 60} goto [ThankYou]

on {silence} goto [ThankYou]

on {#} goto [ThankYou]

 

Position=411,679

 

[ThankYou]

Type=Play

DispSize=69

Txt=Play a sound file, then await a response...

PlayFile1=$RV[Lng_Choice]\Pause1_0.wav, $RV[Lng_Choice]\ThankYou.wav

Replay=0,0

strTtsText=

on {timeout 0} goto [Hangup the Call]

 

Position=414,781

 

[JobOffers]

Type=Play

DispSize=69

Txt=Play a sound file, then await a response...

PlayFile1=$RV[Lng_Choice]\Pause1_0.wav,JobOffers\$RV[Lng_Choice].wav,$RV[Lng_Choice]\Pause1_0.wav

Replay=0,0

strTtsText=

on {timeout 0} goto [Options]

 

Position=37,681

 

[Evaluate_JO_YES]

Type=Evaluate

DispSize=69

Txt=Evaluate the Result Variable specified, and select the path which matches the current value of the Result Variable

Expression=$RV[Options]

ExprNewRV=

ExprStoreRV=0

on {1} gosub [X:\Register.vgs|EnterPhone]

on {2} gosub [Leave_Msg]

on {3} goto [JobOffers]

 

Position=36,568

 

[Evaluate_JO_NO]

Type=Evaluate

DispSize=69

Txt=Evaluate the Result Variable specified, and select the path which matches the current value of the Result Variable

Expression=$RV[Options]

ExprNewRV=

ExprStoreRV=0

on {1} gosub [X:\Register.vgs|EnterPhone]

on {2} gosub [Leave_Msg]

 

Position=222,564

 

[Job_Offers]

Type=Run VB Script

DispSize=69

Txt=Run a VB Script.

VbsFileToRun=

VbsWait=1

VbScript=set fso = CreateObject("Scripting.FileSystemObject")

set fileV = fso.OpenTextFile("X:\VarJobOffers.txt", 1)

 

sEntireFile = fileV.ReadAll

fileV.close

 

set vg = CreateObject("VoiceGuide.CommandLink")

vg.RvSet $RV_LINEID, "Job_Offers", sEntireFile

 

sReturnValue = vg.RvGet($RV_LINEID, "$RV_Job_Offers")

 

 

set vg = Nothing 'always deallocate after use...

set fileV = Nothing 'always deallocate after use...

set fso = Nothing

 

MsgBox sReturnValue

 

 

 

Const ForReading = 1

Const ForWriting = 2

Const ForAppending = 8

set fso = CreateObject("Scripting.FileSystemObject")

set tsFile = fso.OpenTextFile("X:\VarJobOffers.txt", ForAppending, True)

tsFile.WriteLine "$RV_STARTTIME, $RV_CIDNUMBER, $RV[EnterClientNumber]"

tsFile.Close

set tsFile = Nothing

set fso = Nothing

 

VbsHoldPlay=

on {success} goto [Options]

 

Position=31,13

Share this post


Link to post

The script you posted is configured to start at module [Job_Offers], yet the trace shows that the script which was used when the call was answered started at module [Play 1]

 

So the trace is not from the same script which you posted... module [Play 1] does not even exit in the script which you posted...

 

Maybe you should check which script VoiceGuide is set up to use when an incoming call arrives...

Share this post


Link to post

it starts with Play1 ->then follows -> Job_Offers.

 

I don't understand what you mean.

Job_Offers(vbs script) does not have to start from the beginning or does it?

Share this post


Link to post

Posted trace shows:

211159.91 5 [Play 1] Playing

...

211202.98 5 [iD_TimeDate_Script] Running VB Script...

...

211203.02 5 [Lng_Choice] Playing

so whatever script was ran it did not go on to module [Job_Offers] after module [Play 1]

 

 

And the posted script does not even have the module [Play1] in it...

 

So the trace is not from the same script which you posted...

 

Maybe you should check which script VoiceGuide is set up to use when an incoming call arrives...

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
×