Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBScript CPx variables

Status
Not open for further replies.

as1981

IS-IT--Management
Sep 28, 2006
394
GB
All,

VM Pro 4.2 with VBS license.

I am trying to compare two variables (I've tried CPx variables and DB variables) and either make the system follow the vbscript action true/false actions or at least set a variable but I can't get it to work. Any help appreciated.

My two script parts are:

if CP1 > CP2 then
voice.result=TRUE
else
voice.result=FALSE
end if

and:

if CP1 > CP2 then
voice.variable=2
else
voice.variable=5
end if

CP1 is set to 10 and CP2 is set to 2 but if I put $VAR into a speak text action it is returned as 5.

Thanks
 
I don't have access to a VB licensed switch, however should the script not be:

if $CP1 > $CP2 then
voice.result=TRUE
else
voice.result=FALSE
end if

and:

if $CP1 > $CP2 then
voice.variable=2
else
voice.variable=5
end if

 
And fire :)


Homo sapiens non urinat in ventum

honey, i fried the IP Office !!!

Sarcasm, it's only one of the services I offer.
 
All,

:-( Now I feel stupid :-(

Thanks for your help. I'll test it later but I'm sure it will work.


 
All,

I've just tested this and if I put in $CP.. then in complaints the $ is an invalid character.

I'm actually pulling dates from the DB. Will the VM Pro condition editor compare option work correctly with dates? If so then I can put the DB variables into CP1 and CP2 and use that option.

Thanks

Andrew
 
I do have a vbscript license but have not played with it to know how it operates. However you have not dimensioned "result" in your example. Well you have not provided all of the code but based on the examples you have to declare that "result" is a variable.

Perhaps you could post your code in its entirety.

The Result property gets and sets the $RES voicemail call variable. The $RES variable contains the result property of a call flow action. The result is action-specific, for example OK, FAILED, BUSY and so on. The call flow action is able to use the variable to determine logic to be based upon the Result of a preceding Action, or as a temporary variable in the VB-Script. However the variable will be overwritten after the VB Action is completed. If the values from the VB action icon need to be passed to subsequent actions, it is advisable to use user variables.

• Owning object: vmprov5.voicescript
• String:
• Set: A string object that contains the new value for the $RES variable. For example: Voice.Result = String
• Get: A string object containing the current value for $RES. For example: String = Voice.Result
• Example

Sub Main (dlgid)
dim registration
Set Voice = CreateObject("vmprov5.voicescript")
registration = Voice.Register(dlgid)
if registration Then
dim result
dim success
DO SOME PROCESSING.
if success Then
Voice.Result = TRUE
else
Voice.Result = FALSE
end if

End Sub


 
Meanwhile back at the batcave I played around with VBScript and was able to build a nice date compare. Using a Generic to set $CP0 to 9/30/2010 I can then use Test Variable to compare $CPO with $Date which is always todays date. Since I like to know what the variables are I use Voice.Speak to play the variables.


Create a module and point a SC to it using feature voicemail collect. From left to right add actions:
Generic
VBScript
Test variable
Speak Text
Speak text

Connect them like this:
Generic.Next > VBScript
VBScript.Success > Test Variable
Test Variable.Variable > Speak Text 1
Test Variable.No Match > Speak Text 2

Generic Settings:
Select Generic Command
Set CPxx Value
Select Data Variable = 0
With Value = 9/30/2010

VBScript Settings
key1= Voice.Speak("When using v b script dollar sign Date the current date is", 1,"Any"dlgid)
key2 = Voice.Speak($DATE, 0, "Any", dlgid)
key3 = Voice.Speak("The Variable $CP0 equals",0,"Any",dlgid)
key4 = Voice.Speak($CP0,0,"Any",dlgid)

Test Variable settings:
Select the Variable to Match = $CP0
Select the parameters to test the variable against =variable($DATE)

Speak text 1
The variable have matched. Variable CP0 is equal to the date function

Speak text 2
The variables do not match. Variable CP0 does not equal the Date function.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top