News:

Would you like to say "Thanks!" for extra support or new features that we provided? Donations are gratefully accepted.

Main Menu

Exercise in arithmetics, let the computer calculate

Started by rudmei, September 17, 2010, 09:20:43 AM

Previous topic - Next topic

0 Members and 5 Guests are viewing this topic.

rudmei

With a small VBScript you can let your computer calculating some arithmetic exercises.
Here is my approach:

I want to tell her (my computer) the exercise like  "how much is 70 divided by 12" or "how much is 12 minus 19"
Voxcommando can handle this structure very easily:

see picture1, I defined the starting phrase "vieviel ist" (how mich is), then a payload range for the numbers (1 to 1000), then a payload xml-file for the operators (see picture2) and then again a payload range for the second number




Payload for operators:




Here is the VBScript:


' read the command line options
' e.g. 5 + 3
'
Dim message,sapi,parameter,objarguments

set sapi = CreateObject("sapi.spvoice")
Set WshShell = WScript.CreateObject("WScript.Shell")

Set objarguments = WScript.Arguments
For i = 0 to objarguments.Count - 1
    parameter= parameter + " " + objarguments(i)
Next


message =  " das macht " & eval(parameter)
sapi.Speak message


Last but not least tell VoxCommando to lauch the calculating VBScript with the three parameters (see Picture3)




OK, that's it, have fun!