Author Topic: Exercise in arithmetics, let the computer calculate  (Read 3938 times)

0 Members and 1 Guest are viewing this topic.

rudmei

  • $upporter
  • Jr. Member
  • *****
  • Posts: 4
  • Karma: 0
    • View Profile
    • Tenkara Einfach Fliegenfischen
Exercise in arithmetics, let the computer calculate
« on: September 17, 2010, 09:20:43 AM »
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:

Code: [Select]
' 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!
« Last Edit: September 17, 2010, 09:32:03 AM by rudmei »