counting program

Duncan Booth duncan at NOSPAMrcp.co.uk
Wed Jan 16 14:36:17 CET 2002


etoffi at bigfoot.com (e toffi) wrote in 
news:655abd4a.0201160353.27d75cbb at posting.google.com:

> i need for a program i am writing to count using speech (in the range
> 1..100 or 1..1000). is there any prior work that i could use?
> 
>  for each in range(100):
>     print each
>     say(each)
>     logic(each) 
>     ....
If you were using a Windows box then you could use Microsoft Agent. e.g.

import win32com.client
import os, time, pythoncom
windir = os.environ['windir']
character = os.path.join(windir, r'msagent\chars\merlin.acs')

def WaitFor(request):
    while request.Status != 0:
        pythoncom.PumpWaitingMessages()
        time.sleep(0.1)

Agent = win32com.client.Dispatch("Agent.Control.2")
Agent.Connected = 1
Agent.Characters.Load("Merlin", character)
Merlin = Agent.Characters("Merlin")

Merlin.Show()
for each in range(10):
    req = Merlin.Speak(str(each))

# Wait for the last request to complete or we get nothing.
WaitFor(Merlin.Hide())




-- 
Duncan Booth                                             duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?



More information about the Python-list mailing list