News:

There is now a ChangeLog page on the wiki
New developments are added at the bottom of the page.

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 1 Guest 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!