Well, thanks to all who are on the list. I myself is an oldtimer in programming, under DOS. Spent a couple of years in college, learning that stuff - back in the mid 80's. Yet, when comes to scripting, under Windows, with object-orientated software, and tie it all in with the Window-Eyes object? WOOPS!
And, I have been asking questions here - and got answers. Others been asking - and got replies. Agreed, sometimes even a simple question, does call for a complicated answer; simply because there is no other way around your problem. But other times, you end up with way too complicated answers. For instance, you are told to 'check this script', or the other, on the Script Central. Thanks! It's a great help! - Hmm, that is, for the ones who are driven scripters. On the SC, we do find a few quite simple scripts. But, is that the ones we are told to go and have a look at? Well, browse the archives, and make up your own mind.
Telling a person, who is asking how to get started with scripting, to go and take a look at scripts that holds hundreds of lines... Be as it will, the author has showered his script with comments. If you were to learn to cook - well, you once were - did the teacher start the first day in the kitchen, telling you to make a seven course dinner for 50 guests, in the wedding of a prominent person?
I did have a glance at your WIKI articles Chip, a little while ago. Not sure, as I am already familiar with the fact, that you can control your computer, via scripts or programs, that you do write yourself. Yet, I feel uncertain about quite a few things, when comes to how to undertake a gven task, and specially so, when comes to linking it with the WE-object. As such, I might fall a bit in between, hence not really benefitting from what is there, at the moment. So, it at least, needs a good deal more work.
On the other hand, putting myself back to my first day in college, behind the keyboard, and with a teacher showing us how to do our first Basic program - which did add up a few numbers, and pressent the results on the screen... Well, in that chair, I would have been overwhelmed by the WIKI. You go there, and almost immediately are told to read this link, that link, and a few more. Hmm! (Smile!)
Again, agree! It is necessary. Simply because, why do we have to invent the wheel over again? It has already been done, and believe it or not, it even has been made round! So, there is tons of info about scripting on the net. And, it is proper to let the user know about that. But, not sure, if you should start out there. Might have been more convinient to do so, at a bit later state. Have a look at most tutorials. They don't start out, telling you to go to the library, and read three dictionaries. They do - almost without exception - start out by building a platform; ensuring that the user (or reader, that is) is capable of following them, all the time. That is quite a task, to undertake; I know. HHave been a teacher in computing, myself; so do speak of experience here.
Yet, what I think alot of newbees need, is some pretty easy scripts to look into. Scripts that are less than a hundred lines, and that do take care of the basics. Even if it will be rather 'useless' what they do, they might just be good stepstones. Looking into the Scripting manual, the first chapter deals with 'your first script'. How wonderful! - ONLY, that is how far you come. Next chapter, throws you into the matter of objects, Properties, Methods and Events. Hmm! Write three lines of a script, and you are ready for the big stuff? - Well, that is the message they are passing through to the newcomer. What they don't tell, is that there is a whole big land, in between. A few more scripts, what would it hurt?
First talking about the scripting manual: How many times have I been told to go and look in the Scripting Manual of WE? Only thing, often that's what I already been doing. I did mention this in a note, a good while back. Thing is, you are often thrown in 'circles'. You read about one Property, and are told it is part of this or that Object. Yes, it gives you the link, for that Object. And, clicking on that one; what does it give you? - The very message, that this object is holding the Property, which you started out with. And, sure! It is that helpful, as to let you have the link back to that property. - Sure, all you who have been glancing at the manual, will know what I mean. And, although I might have put it all at the very tip, you might agree, it is not exactly informative for a newcomer. HOW many times, I do wish, there would have been just a simple line or two, to illustrate the use of a given instruction? For you who are into the matter, try to get hold of the very Braille Table currently in use... It took me literally HOURS, with the manual, to figure what I did not understand. Then, a couple of messages on the list, before a kind person showed me how to link together the whole line of Object.Property.Property.Method.Item, or whatever it was... Puff! If that example had been right there on the screen! How many more SCRIPTERS would we have, that would have known right away? Not asking a whole 1000 line script, just the very 'COMPLETE' definition of the instruction. Such a thing, would have given the newcomer a far quicker idea of how the diferent Properties and Methods link together - than could you have done, with pages of explanation. It really feels like walking in a jungle - when you happened to leave your GPS at home. For those who are totally familiar with Object-based scripting, I am sure, the manual is a nice handy 'quick reference'. But then, that is what it should be named; not a MANUAL... :)
And, let me then direct a few words to all you, who want to start out scripting: Yes, it is amazing, when you see what scripting can do, to even the very most inaccessible software. Look what has been done to SKype, and WinAmp! Or, the Office scripts! Or, how about the ProgressBar, HourlyChime, and so forth! Yeh, well, how nice is it, with simple scripts, that helps you out, simply by giving a certain sound, when a given thing happens on your screen. Great all of that stuff, ain't it? What if YOU could make the very SCRIPT, that would open up accessibility, for another software package; maybe even changing the daily life of a given group of users!!!
Yes, it would be great. And, you might reach your intentional goal. Eventually! Those who have authored the scripts mentioned above, will often have been found to do programming and scripting for years. They might be specially edducated within computers, or have taken hours, days, weeks - just reading, and researching. Why am I pointing these things out? Simply because, I sometimes get a feeling, that some people drop on to the list, asking a question, how to do so and so; having more or less ABSOLUTELY no clue, when comes to scripting. So, you newbees, take it easy. You didn't learn to dress yourself, in one day. Neither to write the message, that you dropped on the list. Simply the fact of being able to type that very message, is based on years of learning to spell, express yourself, and operate the computer; let alone the time it took to get used to Window-Eyes. Would an infant start out by running the Marathon; then, upon completing that task, sit down, and think: 'Hmm, maybe, it is time to start learn to walk'??? (Smile!)
Again, this is where we need to start them out! Teach them the basics. Let them know, that, YES, there is good chances, you will be able to contribute scripting, but that will take a good deal of effort and time investment on your part. Then, when they have all this established, go ahead and point them to ten thousand webpages, and let them run the maze of the Scripting Manual. And, when a person happens to drop a message, asking how to perform a certain task in WE, don't just throw him back to the Scripting Manual. Realize, please, that he might come directly therefrom, and there obviously might be a good reason, why he is asking. And, if so would happen, that she had not been reading the manual, taking the 'easy way around', just jumping on the list asking; well, what does it hurt to still give a bit of conscise answers? You know, you could even save your answers, and/or the ones other gives, and in time build your WIKI articles, or tutorials, based on these. That, would have given you a good pointer, as to where the 'bird' loves to hide; what the newcomers feel uncertain about, and where to start and where to end.
----- Original Message ----- From: "Tom Kingston" <[email protected]>
To: <[email protected]> Sent: Monday, August 23, 2010 5:06 AM Subject: Re: Window-Eyes Script Writing
Hey Chip,Yeah, I've wandered around the web from time to time and everything I find seems to be either one extreme or the other. That is to say, the tutorials are narrowly focused either on a specific use of VBScript, e.g. integrating into web pages or very advanced topics, or, so basic and/or vague, they really don't seem to be of much help for the beginner. Of course we can keep searching, but even that consumes a lot of time. And I probably will keep looking. In the mean time, as I've said, I'm just playing around with tackling writing one myself. It's kind of a feasibility test because as I'm sure you well know, it often seems easy when we think of a specific topic or aspect of scripting, but I've already seen how much I forget what is just automatic for me. In other words, I get to explaining something and realize, well, I've got to touch on this in order to explain that, but in order to understand both I've got to at least skim over the other, and so on and so on. I'm trying to take a 3 tiered approach.1. Learn VBScript.2. Learn the concept of an object model and how to integrate it into a script.3. Then get into actual Window-Eyes scripting.Oh, but what a project. I've written almost 20 pages already and have only skimmed the tip of the VBScript iceberg. But who knows. Maybe this will slowly come together.Regards, Tom----- Original Message ----- From: "Chip Orange" <[email protected]>To: <[email protected]> Sent: Sunday, August 22, 2010 12:53 PM Subject: RE: Window-Eyes Script Writingok, I'm reading this post of yours Tom, and I may want to retract somethingI'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 thewheel 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 wewanted 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 bothVBScript and basic programming concepts; so, maybe what we should do is tostart a hunt for the best VBScript tutorial out there, which seems leasttied to any environment? If such a tutorial exists, maybe it could be theonly one pointed to from the wiki or GW's developer central? I could be equally convinced it's better to teach VBScript, basicprogramming, and WE specific scripting altogether, but better doesn't meanit'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 WritingI should also clarify for anyone interested in learning to script that this TTS example has absolutely nothing to do with Window-Eyes scripting. Read itand be intimidated if you wish. Then realize that in order to makeWindow-Eyes speak you do nothing more than use a Speak command, such as inthe 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 theWindows 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 WritingThanks for the lesson, but I've been programming for 20 years. I tried toclarify 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 WritingTom, 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 examplesif you want. The stuff below uses the class method and after you reach theclass end statement you get into the body of the vb script. There you cannote 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 offile you want while you are learning. Using the class method below and the format in the body beneath theclass to have any prompt messages sepak. Then you can teach yourself allabout .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.ClearValue2Percent = 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 Panelvoice.", c.getAsync and c.getXml c.setPitch = 1c.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.getXmlc.Speak "This is: " & c.getVoiceName & " and this is the end!", c.getXmlc.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.getPuncc.Speak "<spell> Who is this, " & c.getVoiceName & "?</spell>", c.getXmlTo: <[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 thiswas all just way over my head, and probably just give up. Regards, Tom
