VoiceGuide IVR Software Main Page
Jump to content

Vbs Modules And Character Translation

Recommended Posts

We are using VG 7 on a 2008 server 64 bits.

 

We have a problem a character translation in the vbs scripts.

 

Using the script designer, The vbs module shows

 

' Choose between Slot and Time

If "$RV[ML_GetAct_Protocol_10_$RV[ProtCompteur]]" <> "" Then

Slot = "$RV[ML_GetAct_Protocol_10_$RV[ProtCompteur]]"

Else

If "$RV[ML_GetAct_Protocol_13_$RV[ProtCompteur]]" <> "" Then

Slot =
"à "
& "$RV[ML_GetAct_Protocol_13_$RV[ProtCompteur]]"

Else

Slot = ""

End If

End If

 

In the vbs file generated at run time, the charracter "à" is changed

 

' Choose between Slot and Time

If "" <> "" Then

Slot = ""

Else

If "" <> "" Then

Slot =
"� "
& ""

Else

Slot = ""

End If

End If

 

Is it a Voice Guide parameter for the character set ?

Share this post


Link to post

Not sure why that character gets changed, it does look like an ASCII character, so it should be fine.

Are you using an English version of Windows or is it set to another Language/Locale?

 

Can you try using

 

Chr(133)

 

instead of specifying the character explicitly? Like this:

 

Slot = Chr(133) & " " & "$RV[ML_GetAct_Protocol_13_$RV[ProtCompteur]]"

 

 

(see http://www.asciitable.com/ for ASCII codes of other similar characters)

Share this post


Link to post

The Windows 2008 is in Us english.

 

But we are running these scripts with VG 5 on another server with a Windows 2003 server also in us english.

 

I have not made the test with the Chr(133).

But it is not a work around for us because we have such characters coming from the database (and not hard coded in the script file) and if we use these fields in a script we have also character transaltion.

 

Example :

 

In the VG script :

 

[

i]' Choose entry notice : quantity specified or not

If "$RV[ML_GetAct_Protocol_14_$RV[ProtCompteur]]" = "" Then

EntryNotice = "$RV[ML_GetAct_Protocol_7_$RV[ProtCompteur]]"

Else

EntryNotice = "$RV[ML_GetAct_Protocol_8_$RV[ProtCompteur]]"

End If
[/i]

 

Where the $RV variables are the result of a database query

 

In the vbs file : (The characters are correct)

 

' Choose entry notice : quantity specified or not

If "" = "" Then

EntryNotice = "Bornes : [ValueMin],
à
[ValueMax] [unite]."

Else

EntryNotice = "Taper * pour valider la quantité annoncée"

End If

 

And when the text is sent to TTS for wave generation, we can see in the VG log file

 

Bornes : 50.00,
Ã
220.00

 

It is like if there is a mix between ANSI and UNICODE.

Share this post


Link to post

And we have the same problem when generating a wave file from a test file

 

The text generated (as I can see in the VG log and I can hear) is

 

100855.693 6 2 1 PrepareAndPlayWavAndTTS sPlayFile=TTS\ML_GetAct_EchecValidOne_F.txt

100855.693 6 2 1 tts orig strTtsFname=C:\Program Files (x86)\VoiceGuide\temp\tts_2_7.wav, bMakeTtsFile=True

100855.693 6 2 1 tts new strTtsFname=C:\Program Files (x86)\VoiceGuide\temp\tts_2_8.wav

100855.697 6 2 1 rv replace start: [$RV[LangDebTag] La validation de cette
r�ponse a �chou�.
$RV[LangFinTag]]

 

and the original text is

 

La validation de cette réponse a échoué.

 

The text file is attached

ML_GetAct_EchecValidOne_F.txt

Share this post


Link to post

I really need help for this point.

 

Here is a new situation :

 

In a VBS module I have the following code

 

' Manage Null Values for Medicine

If "$RV[ML_GetAct_GetProtocolDetail_17_1]" = "" Then

MedicineInsValue = "Null"

Else

MedicineInsValue = "$RV[ML_GetAct_GetProtocolDetail_17_1]"

MedicineInsValue = Replace(cstr(MedicineInsValue), "'", "''", 1, -1, 1)

MedicineInsValue = "'" + cstr(MedicineInsValue) + "'"

End If

 

It is perfectly managed by Vg and at execution time, after replacement of VG variables it gives

 

' Manage Null Values for Medicine

If "Nouvelle K7 posée" = "" Then

MedicineInsValue = "Null"

Else

MedicineInsValue = "Nouvelle K7 posée"

MedicineInsValue = Replace(MedicineInsValue, "'", "''", 1, -1, 1)

MedicineInsValue = "'" + MedicineInsValue + "'"

End If

 

Just after in my code I use these variable MedicineInsValue to build an SQL statment

 

SqlCurrentAction = " INSERT INTO T_Action (Patient_Id, Medicine) Values ($RV[PatientId], " + MedicineInsValue + ")"

 

and the result is

 

INSERT INTO T_Action (Patient_Id, Medicine) Values (100041, 'Nouvelle K7 posée')

 

Can anyone understand and help me ?

Tahnk you

Share this post


Link to post

How do you ascertain that the SQL statement becomes "INSERT INTO T_Action (Patient_Id, Medicine) Values (100041, 'Nouvelle K7 posée')" ? Is this from the trace in the database used?

 

Have you tried hard coding the SQL statement to be:

 

INSERT INTO T_Action (Patient_Id, Medicine) Values (100041, 'Nouvelle K7 posée')

 

Please try doing that first and see if the database accepts the Unicode character.

 

If above works OK then you can just try using the $RV directly in the SQL line:

 

INSERT INTO T_Action (Patient_Id, Medicine) Values (100041, '$RV[ML_GetAct_GetProtocolDetail_17_1]')

Share this post


Link to post

First I have seen the bad SQL statment in 2 places : in the VgEngine log and in the SQL Profiler where I see 'Nouvelle K7 posée'

 

I have also tested to use the $RV variable directly in the construction of the SQL statment but the translation happens when I assign the value of my vb variable to a $RV variable using run_ResultReturn. If I open the vbs file I see the correct string but in the VG log the line rvns add [sqlCurrentAction] ...... is wrong.

 

Notice that my scripts have been created on a 2003 server, and my VG application runs perfectly on the 2003 server without such translations.

Share this post


Link to post
If I open the vbs file I see the correct string

The VBS file (saved in \temp\ subdirectory) is the actual code ran.

 

If the SQL Profiler shows that a different sting is actually sent to the database then this means the VBScript interpreter or the database driver cannot handle Unicode characters.

 

Probably best to setup some test .VBS fils with some Unicode characters in it and see if it runs OK (sounds like it may not).

 

I think that VBScript only supports little -endian UTF-16 Unicode characters - not UTF-8 (?).

 

Do you know if the characters that you use are UTF-8 encoded? Can you use UTF-16 instead?

 

Not sure why it would work on Win2003 but not on Win2008.

 

Another option is to try C# instead of VBScript. Can you code your scripts in C# and test if they work OK for you? (you may need to use C# development tool like Visual Studio Express) If yes then we can supply a version of VG that supports C# scripting.

Share this post


Link to post

To show you exactly the problem I have written a small script (TestVG.vgs attached).

This script contains two VBS modules and Write a string to a file.

 

I join also the vbs file generated by VG for execution. To load it I have renamed in vbs_49_1.txt

 

As you can see, the string in the VBS file is wrong.

 

I have checked the encoding of some VBS files in the VG temp directory and it is very strange because some of them are encoded using ANSI character set and others using "UTF-8 without BOM"

I don't know how I can decide how the VBS files will be encoded.

 

Our VG application contains a lot of scripts and also to rewrite all of them in c# is a too big work.

TestVG.vgs

vbs_49_1.txt

Share this post


Link to post

Please update your system to this version of VoiceGuide:

[old link removed]

(just install it over the top of your current version)

Then run your test script and post the vgEngine traces, the temporary .vbs files, and the output files that are created on your system.

Please .ZIP up files before posting.


Please also run this command on your system in a DOS Command Prompt window, and advise output:

mode con cp

Share this post


Link to post

I made the test and the result is OK.

 

The result of Mode con cp is :

 

Status for device CON:

Code page : 850

 

I have also tried my normal application but encountered some other problems ...

VG TRaces.zip

Share this post


Link to post

OK, trace of the demo script looks fine.

 

I have also tried my normal application but encountered some other problems ...

Can you post traces/scripts and indicate in what module you encountered problems?

 

The changes which fixed the issue still need to be applied to a few more interface calls. Version supplied was just a test to confirm the approach taken works on your system.

Share this post


Link to post

OK, I have conduct some test for character translation with modules Evaluation, Phome Message and Database query and it works fine.

 

The error I have encountered with my application was in a complex ReturnResult in a vbs module. I use 2 level of $RV variable to build on $RV variable name

 

Example

 

vg.Run_ResultReturn $RV_LINEID, "[CallerType]{$RV[ML_Direct_VerifIdent_1_$RV[identifNr]]}[CallerId]{$RV[ML_Direct_VerifIdent_2_$RV[identifNr]]}[RealPerson]{$RV[ML_Direct_FindCallerData_7_1]}[CallerTitle]{$RV[ML_Direct_FindCallerData_1_1]}[CallerName]{$RV[ML_Direct_FindCallerData_2_1]}

 

In the log I see the initialisation of the variable (comming from the database

 

120535.262 23 2 1 rv add [ML_Direct_FindCallerData_1_1]{Role}

120535.262 23 d added ML_Direct_FindCallerData_1_1 | Role | 93

120535.262 23 d added ML_Direct_FindCallerData_1_1 | Role | 159

 

and next when $RV variables are replaced in the vbs module, I see

 

120535.268 6 rv dbg rv_retrieve did not find ML_Direct_VerifIdent_1_$RV[identifNr

 

and next

 

120536.418 6 2 1 qScr run cmdRun_ResultReturn sCode=[] iActionID=0, crn=0[0|0|0|0|0][[CallerType]{]}[CallerId]{]}[Re......|||||]

120536.418 6 2 1 rvns add [CallerType]{]}

120536.418 6 d updtd CallerType | ] | 184

120536.418 6 2 1 rvns add [CallerId]{]}

120536.418 6 d updtd CallerId | ] | 184

 

I am sorry I can not post the vbs script and traces because the concerned vb script contains information concerning the security. But if you need it, I can send zipped traces on a mail address

Share this post


Link to post

The version we supplied for testing is a pre-release v7.2. Some changes to the $RV interpretation system were made in v7.2 and looks like a bug has crept in.

 

We will look into this nested $RVs issue and should be able to supply a fix within 24 hours.

Share this post


Link to post

Please update system to this version of VoiceGuide:

[old link removed]

The 'nested $RV' issue should be now fixed in this version.

Share this post


Link to post

Thank you for this new version.

 

I have tested it using my application and it works fine.

 

I just have seen 2 points.

 

First, replacement of $RV variables becomes case sensitive.

In the log file :

 

Query on the datebase

140112.150 24 2 1 rv add [ML_GetPa_Verif_2_1]{Test2}

140112.150 24 d added ML_GetPa_Verif_2_1 | Test2 | ( 4d 4c 5f 47 65 74 50 61 5f 56 65 72 69 66 5f 32 5f 31 | 54 65 73 74 32 | 18)

140112.151 24 d added ML_GetPa_Verif_2_1 | Test2 | ( 4d 4c 5f 47 65 74 50 61 5f 56 65 72 69 66 5f 32 5f 31 | 54 65 73 74 32 | 236)

 

Attribution of value to dedicated $RV variables

------------------------------

set vg = CreateObject("VoiceGuide.CommandLink")

vg.Run_ResultReturn $RV_LINEID, "[PatientId]{$RV[ML_GetPa_Verif_4_1]}[PatientTitle]{$RV[ML_GetPa_Verif_1_1]}[PatientName]{$RV[ML_GetPA_Verif_2_1]}"

set vg = Nothing

------------------------------

140112.164 6 rv dbg rv_retrieve did not find [ML_GetPA_Verif_2_1] ( 4d 4c 5f 47 65 74 50 41 5f 56 65 72 69 66 5f 32 5f 31)

140112.164 6 2 1 rv replace end [set vg = CreateObject("VoiceGuide.CommandLink")

vg.Run_ResultReturn 2, "[PatientId]{101170}[PatientTitle]{Monsieur}[PatientName]{}"

set vg = Nothing]

 

As you can see, I have written the variable name ML_GetPA... instead of ML_GetPa... and VG has not found the variable.

It is not a problem for me, I have corrected my application.

 

Second point :

 

It is not a problem but I have seen some special charcters in the VG log file

 

172434.462 13 7 3 rem Run_ResultReturn é [[ActionQuestion]{Nouvelle K.7. posée . . . . Entrez : 1, Oui. 2, Non. .}[QuestionFile]{TTS\ML_GetAct_DemAction_F.txt}[ActionShortTextUnit]{Nouvelle K.7. posée}[ErrMEssage]{}[ML_GetAct_EnregMessage]{}[CptQuestOblig]{0}[ML_GetAct_GetProtocolDetail_43_1]{1}] [[ActionQuestion]{Nouvelle K.7. posée . . . . Entrez : 1, Oui. 2, Non. .}[QuestionFile]{TTS\ML_GetAct_DemAction_F.txt}[ActionShortTextUnit]{Nouvelle K.7. posée}[ErrMEssage]{}[ML_GetAct_EnregMessage]{}[CptQuestOblig]{0}[ML_GetAct_GetProtocolDetail_43_1]{1}] 260 260

172434.462 13 7 3 qScr add cmdRun_ResultReturn 0

172434.462 6 7 3 qScr run cmdRun_ResultReturn sCode=[] iActionID=0, crn=0[0|0|0|0|0][[ActionQuestion]{Nouvelle K.7. posée . . . . Entrez : 1, Oui. 2, Non. .}[QuestionFile]{TTS\ML_GetAct_DemAction_F.txt}[ActionShortTextUnit]{Nouvelle K.7. posée}[ErrMEssage]{}[ML_GetAct_EnregMessage]{}[CptQuestOblig]{0}[ML_GetAct_GetProtocolDetail_43_1]{1}|||||]

 

But as you can see in the last line the returned variable is correct

 

Finaly I have a question. You told that the delivered version is a pre-release version.

Is the delivered version strong enough to go in production with ?

Share this post


Link to post

I have tested the pre-release version and I have remarqued that

 

1.- $RV variables names becomes case sensitive

 

Result of database query

 

140112.150 24 2 1 rv add [ML_GetPa_Verif_2_1]{Test2}

140112.150 24 d added ML_GetPa_Verif_2_1 | Test2 | ( 4d 4c 5f 47 65 74 50 61 5f 56 65 72 69 66 5f 32 5f 31 | 54 65 73 74 32 | 18)

 

Usage of variable in a vbs module (ML_GetPA_Verif_2_1 is written with an upper A)

 

vg.Run_ResultReturn $RV_LINEID, "[PatientId]{$RV[ML_GetPa_Verif_4_1]}[PatientTitle]{$RV[ML_GetPa_Verif_1_1]}[PatientName]{$RV[ML_GetPA_Verif_2_1]}"

 

VG Error message

 

vg.Run_ResultReturn $RV_LINEID, "[PatientId]{$RV[ML_GetPa_Verif_4_1]}[PatientTitle]{$RV[ML_GetPa_Verif_1_1]}[PatientName]{$RV[ML_GetPA_Verif_2_1]}"

 

2.- Some traces in the log uses wrong characters but only in the Engine log

 

140123.793 26 2 1 rem Run_ResultReturn é [[ActionQuestion]{Nouvelle K.7. posée . . . . Entrez : 1, Oui. 2, Non. .}] 260 260

140123.793 6 2 1 qScr run cmdRun_ResultReturn sCode=[] iActionID=0, crn=0[0|0|0|0|0][[ActionQuestion]{Nouvelle K.7. posée . . . . Entrez : 1, Oui. 2, Non. |||||]

140123.793 6 d added ActionQuestion | Nouvelle K.7. posée . . . . Entrez : 1, Oui. 2, Non. . | ( 41 63 74 69 6f 6e 51 75 65 73 74 69 6f 6e |)

 

3.- The licence manager does not show the unique Id of my Dialogic card

 

And I have a question

 

1.- Is the pre-release version delivered strong enough to use it in a production environment ?

Share this post


Link to post

Will forward your comment about $RV comparison being case sensitive to the the programming team.

 

The VG internal logging may display information in various formats, but it looks like on application level the text characters are correctly stored.

 

Is the License Manager started after the VoiceGuide service has started?

 

1.- Is the pre-release version delivered strong enough to use it in a production environment ?

The main changes in v7.2 are to the $RV system and a few other higher level type functionality. The base layers remained unchanged from previous versions and we do not anticipate any core stability/performance issues. At this stage v7.2 is still classed as a Beta, but if you find that functionally it works for you then you can probably move with it to production.

Share this post


Link to post

I tried the licence manager with

 

- Dialogic and VG off

- Dialogic on and VG off

- Dialogic on and VG on

 

and never it gives me the unique id of the Dialogic board

Share this post


Link to post

The UniqueID is the serial number of the Dialogic card used.

 

From previously posted traces we can see that the UniqueID of your system is FX038396.

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
×