ok, I'm reading this post of yours Tom, and I may want to retract something I've said earlier:
I said there was little point in anyone here teaching VBScript; it's been done many times out there on the web already. But you're correct, it's always done in the context of some other environment, which will be different from the WE scripting environment. some environments such as WSH will be a lot closer to WE than say an HTML page, as you tried to point out, but my point of why try to reinvent the wheel isn't quite valid; no one out there is teaching VBScript free of any environment (that I know about anyway), and that's what we would need, if we wanted to separate out the learning of VBScript and basic programming skills, from use of WE specific features. still, as you also started to mention, it's a lot of work to teach both VBScript and basic programming concepts; so, maybe what we should do is to start a hunt for the best VBScript tutorial out there, which seems least tied to any environment? If such a tutorial exists, maybe it could be the only one pointed to from the wiki or GW's developer central? I could be equally convinced it's better to teach VBScript, basic programming, and WE specific scripting altogether, but better doesn't mean it's possible for us to get done. Chip -----Original Message----- From: Tom Kingston [mailto:[email protected]] Sent: Saturday, August 21, 2010 11:30 PM To: [email protected] Subject: Re: Window-Eyes Script Writing I should also clarify for anyone interested in learning to script that this TTS example has absolutely nothing to do with Window-Eyes scripting. Read it and be intimidated if you wish. Then realize that in order to make Window-Eyes speak you do nothing more than use a Speak command, such as in the following. Speak "Hello world!" In a script you're writing for Window-Eyes, that's it. Use the Speak command to tell Window-Eyes what to speak and you're done. The method outlined below is for a stand-alone script to run independent of Window-Eyes by using the Windows scripting host. Again, this has absolutely nothing to do with scripting Window-Eyes. Tom ----- Original Message ----- From: "Tom Kingston" <[email protected]> To: <[email protected]> Sent: Saturday, August 21, 2010 11:19 PM Subject: Re: Window-Eyes Script Writing > Thanks for the lesson, but I've been programming for 20 years. I tried to > clarify my point in my last message. I apologize if my previous message > was so misleading. > > Regards, > Tom > > ----- Original Message ----- > From: "BT" <[email protected]> > To: <[email protected]> > Sent: Saturday, August 21, 2010 11:02 PM > Subject: Re: Window-Eyes Script Writing > > >> Tom, >> >> Below is a Sapi 5 VB script example which will allow you to have >> speech >> and write vb script files and not use html at all. As long as you >> computer >> allows you to run VB script all you have to do is have a file with the >> extension .VBS. >> You can copy the stuff below or save the attachment and make sure the >> file ends with .vbs. This will allow you to test most of your vb examples >> if >> you want. The stuff below uses the class method and after you reach the >> class end statement you get into the body of the vb script. There you can >> note the formats used to just do a test run of voices. >> >> The .vbs file can be opened up in Notepad and you can make any kind of >> file you want while you are learning. >> Using the class method below and the format in the body beneath the >> class to have any prompt messages sepak. Then you can teach yourself all >> about .VBS. or scripting. Then get into the Windoweyes scripting after >> you >> have mastered VB scripting. >> See the attached if it gets posted along with this email. >> >> Bruce >> >> >> >> 'MODIFIED JUNE 30 2010 FOR voicelist redim, tts4 and tts5! >> 'JUNE 29 2010 FOR CLASS METHOD OF SAPI 5! >> 'JUNE 26 FOR ALL SPEECH METHODS! >> Class createSapiObject >> Private tts5 >> Private tts4 >> Private sapiQ >> Private voices5count >> Private voices4count >> Private voice5list() >> Private voice4list() >> Private defaultspeed >> Private pitch >> Private defaultvolume >> Private default_spk >> Private sync >> Private async >> Private xml >> Private isfile >> Private no_xml >> Private punc >> >> Private Sub Class_Initialize >> dim i >> Set tts5 = CreateObject("sapi.spvoice") >> tts5.Speak("") >> Set tts4 = CreateObject("ActiveVoice.ActiveVoice") >> tts4.Speak("") >> sapiMode = 5 >> voices5count = tts5.GetVoices.Count >> voices4count = tts4.CountEngines >> if voices4count<=10 then >> ReDim voice4list(10) >> else >> if voices4count<=20 then >> ReDim voice4list(20) >> else >> if voices4count<=30 then >> ReDim voice4list(30) >> else >> ReDim voice4list(40) >> end if >> end if >> end if >> if voices5count<10 then >> ReDim voice5list(10) >> else >> if voices5count<20 then >> ReDim voice5list(20) >> else >> if voices5count<30 then >> ReDim voice5list(30) >> else >> ReDim voice5list(40) >> end if >> end if >> end if >> for i = 1 to voices4count >> voice4list( i) = tts4.modeName( num) >> next >> for i = 0 to voices5count-1 >> voice5list( i) = tts5.GetVoices.Item( i).GetDescription >> next >> defaultspeed = 0 >> pitch = 0 >> defaultvolume = 100 >> default_spk = 0 >> sync = 1 'CONTINUOUS SPEECH! >> async = 2 'STOP BEFORE SPEAK! >> xml = 8 'USE XML TAGS! >> isfile = 16 'OPEN WAV FILE WITH TEXT! >> no_xml = 32 'IGNORE XML TAGS! >> punc = 64 'SAY ALL PUNCTUATIONS! >> End Sub >> >> Public Property Get sapiMode >> sapiMode = sapiQ >> End Property >> >> Public Property Let sapiMode( num) >> sapiQ = num >> End Property >> >> Public Property Get voiceCount >> if sapiQ = 5 then >> voiceCount = voices5count >> else >> voiceCount = voices4count >> end if >> End Property >> >> Public Property Get normRate >> if sapiQ = 5 then >> normRate = 0 >> else >> normRate = defaultspeed >> end if >> End Property >> >> Public Property Get normPitch >> if sapiQ = 5 then >> normPitch = 0 >> else >> normPitch = defaultpitch >> end if >> End Property >> >> Public Property Get normVolume >> if sapiQ = 5 then >> normVolume = 100 >> else >> normVolume = defaultvolume >> end if >> End Property >> >> Public Property Get getDefSpk >> getDefSpk = default_spk >> End Property >> >> Public Property Get getSync >> getSync = sync >> End Property >> >> Public Property Get getAsync >> getAsync = async >> End Property >> >> Public Property Get getXml >> getXml = xml >> End Property >> >> Public Property Get getIsFile >> getIsFile = isfile >> End Property >> >> Public Property Get getNoXml >> getNoXml = no_xml >> End Property >> >> Public Property Get getPunc >> getPunc = punc >> End Property >> >> Public Property Get Value2Percent( current, min, max) >> 'ADJUST VALUE TO PERCENTAGE! >> 'MAX VALUE IF ERROR! >> On Error Resume Next >> Err.Clear >> Value2Percent = int( round( abs( (current - min) / (max - min)) * >> 100.00, 2)) >> if Err.Number <> 0 then >> Value2Percent = max >> end if >> End Property >> >> Public Property Get getRate >> if sapiQ = 5 then >> getRate = tts5.Rate >> else >> getRate = Value2Percent( tts4.Speed, tts4.minSpeed, >> tts4.maxSpeed) >> end if >> End Property >> >> Public Property Get getPitch >> if sapiQ = 5 then >> getPitch = pitch >> else >> getPitch = Value2Percent( tts4.Pitch, tts4.minPitch, >> tts4.maxPitch) >> end if >> End Property >> >> Public Property Get getVolume >> if sapiQ = 5 then >> getVolume = tts5.Volume >> else >> getVolume = Value2Percent( tts4.VolumeLeft, >> tts4.minVolumeLeft, >> tts4.maxVolumeLeft) >> end if >> End Property >> >> Public Property Get Percent2Value( percent, min, max) >> 'ADJUST PERCENTAGE to value! >> Percent2Value = int( round( abs( percent / 100.00) * (max - min), >> 2) >> + min) >> End Property >> >> Public Property Let setRate( percent) >> if sapiQ = 5 then >> tts5.Rate = percent >> tts5.Speak("") >> else >> Dim val, max >> max = tts4.maxSpeed-1 >> val = Percent2Value( percent, tts4.minSpeed, max+1) >> ' SAPI4 DOES NOT LIKE MAX SPEED! >> if val > max then >> val = max >> End If >> tts4.Speed = val >> tts4.Speak("") >> end if >> End Property >> >> Public Property Let setPitch( percent) >> if sapiQ = 5 then >> pitch = percent >> else >> tts4.Pitch = Percent2Value( percent, tts4.minPitch, >> tts4.maxPitch) >> end if >> End Property >> >> Public Property Let setVolume( percent) >> if sapiQ = 5 then >> tts5.Volume = percent >> tts5.Speak("") >> else >> Dim val >> val = Percent2Value( percent, tts4.minVolumeLeft, >> tts4.maxVolumeLeft) >> tts4.VolumeLeft = val >> tts4.VolumeRight = val >> tts4.Speak("") >> end if >> End Property >> >> Public Property Get getVoice >> if sapiQ = 5 then >> getVoice = tts5.Voice >> else >> getVoice = tts.currentMode >> end if >> End Property >> >> Public Property Let setVoiceByNum( num) >> if sapiQ = 5 then >> Set tts5.voice = tts5.GetVoices.Item( num) >> tts5.Speak("") >> else >> tts4.currentMode = num >> tts4.Speak("") >> end if >> End Property >> >> Public Property Get getVoiceNameByNum( num) >> if sapiQ = 5 then >> getVoiceNameByNum = tts5.GetVoices.Item( num).GetDescription >> else >> getVoiceNameByNum = tts4.modeName( num) >> end if >> End Property >> >> Public Property Get getListVoiceNameByNum( num) >> if sapiQ = 5 then >> getListVoiceNameByNum = voice5list( num) >> else >> getListVoiceNameByNum = voice4list( num) >> end if >> End Property >> >> Public Property Get getVoiceName >> if sapiQ = 5 then >> getVoiceName = tts5.voice.GetDescription >> else >> getVoiceName = tts4.modeName( tts4.currentMode) >> end if >> End Property >> >> Public Property Let setVoiceByName( name) >> Dim b, e, i, vn >> name = LCase( name) >> b=0 >> e = voices5count-1 >> if sapiQ = 4 then >> b=1 >> e = voices4count >> end if >> for i = b to e >> vn = LCase( getVoiceNameByNum( i)) >> if InStr( vn, name) then >> setVoiceByNum = i >> Exit Property >> End If >> next >> End Property >> >> Public Sub Talk(txt) >> 'VOICE IS SPOKEN IN SAPI 4 AND WAITS UNTIL VOICE IS DONE! >> tts4.Speak txt >> waitFlag = tts4.Speaking >> Do While waitFlag >> WScript.Sleep 10 >> waitFlag = tts4.Speaking >> Loop >> End Sub >> >> Public Sub Speak( txt, flags) >> if sapiQ = 5 then >> tts5.Speak "<pitch absmiddle=""" & CStr( getPitch) & """>" & >> txt >> & "</pitch>", flags >> else >> talk txt >> end if >> ' tts.Speak txt, flags >> End Sub >> End Class >> >> ' LETS START PROGRAM TEST FOR SAPI 5 VOICES! >> Dim list, message, txt, i, p, parm, strVal >> Set c = new createSapiObject >> c.sapiMode = 5 >> ' c.sapiMode = 4 >> 'NOTE: SET LOOP FOR POINTER VALUES 0 OR 1 IN LIST! >> c.Speak c.getVoiceName & " Is Speaking! This is the default Control Panel >> voice.", c.getAsync and c.getXml >> c.setPitch = 1 >> c.Speak " This is Sapi: " & c.sapiMode & " and there are " & c.voiceCount >> & >> " Voices!", c.getXml >> list = "" >> for count = 0 to 2 'c.voiceCount -1 >> c.setVoiceByNum = count >> list = list & "(" & count & ") = " & c.getVoiceName & vbCrLf >> c.setPitch = c.getPitch + 1 >> txt = count & " is: " & c.getVoiceName & "!" >> c.Speak txt, c.getXml 'or c.getPunc >> next >> c.setVoiceByName = "mary" >> c.setPitch = 0 >> c.Speak "Hi, " & c.getListVoiceNameByNum( 5) & "!", c.getXml >> c.Speak "This is: " & c.getVoiceName & " and this is the end!", c.getXml >> c.setVoiceByName = c.getListVoiceNameByNum( 9) >> c.Speak "Who is this, " & c.getVoiceName & "?", c.getXml >> c.setRate = -1 >> c.Speak "This is punctuation test and who is this, " & c.getVoiceName & >> "?", >> c.getXml or c.getPunc >> c.Speak "<spell> Who is this, " & c.getVoiceName & "?</spell>", c.getXml >> >> To: <[email protected]> >> Sent: Saturday, August 21, 2010 9:36 PM >> Subject: Re: Window-Eyes Script Writing >> >> >> And therein lies the problem. I went to the first link and it focuses >> strictly on using VBScript within web pages for Internet Explorer. It >> tells >> you that in order to understand the explanations and examples you must >> first >> understand html and xml. While we do use xml in our scripts, I thought, >> were >> I a beginner this would be mind boggling, reading VBScript code within >> html >> code. And the initial examples went straight to using COM automation. >> Again, >> were I a beginner, I'd be totally lost right from the get-go, think this >> was >> all just way over my head, and probably just give up. >> >> Regards, >> Tom >> >
