Hi Mike, If you can take a little time, there are 20 or so audio classes on scripting, along with their example text files, archived on the GW web site at:
https://www.gwmicro.com/App_Central/Developers/Interactive_Classes/ classes 5 through 7 cover writing event handlers, but if you're new to coding, I'd suggest you start at class 1. no background in programming is assumed for these classes. one question: is the software which you are trying to work with downloadable from the internet? Or is it a web site we can get to? Others may be willing to have a look at the problem if they can get to it. One point which may or may not help: an app I wrote called MS Office has code in it where I deal with a listbox which would not speak at all, as various items were highlighted. It has code showing how I determined the background color, and then found the highlighted item each time an arrow key was pressed, and spoke it. It's hard to dig just this code out from all the other things this app does, but I made an effort to comment everything, so you may want to download it and have a look. hth, Chip -----Original Message----- From: Mike Wigle [mailto:[email protected]] Sent: Monday, July 25, 2011 3:46 PM To: [email protected] Subject: Need help! Hi everyone, I'm very new to coding and have found myself needing to make a very inaccessible application accessible in a short period of time. I've done a fair amount of window reclassification and that has helped in some areas. However, I am finding myself in need of being able to do some far more complex manipulation. For example, right now I have several list boxes that Window-Eyes does not read properly when arrowing down. I can read the text with the mouse cursor but even when I route the mouse to the PC cursor it does not route to the correct item in the list that is highlighted. Instead, it just goes to the top. I was wondering if anyone has suggestions on how I might approach coding to have WE watch for the change in background color of the individual list items and have the mouse cursor route there and read the line. Or, if you have better suggestions. Right now I'm in a time crunch to make this work for my client. It just needs to talk more efficiently than it is now. I have her doing some horrendous processes to make these list boxes usable. Basically, I think I'm needing to find some example code of listening for events of specific window objects. Any thoughts or ideas would be greatly appreciated. Thanks. Michael Wigle Access Technology Specialist Cincinnati Association for the Blind and Visually Impaired 2045 Gilbert Ave. Cincinnati, OH 45202 Office: 513-487-4243 Web: http://www.cincyblind.org Disclaimer: The information contained in this electronic mail message may be confidential and protected information intended only for the use of the individual or entity named above. As the recipient of this information you may be prohibited by State and Federal law from disclosing this information to any other party without specific written authorization from the individual to whom it pertains. If you have received this communication in error, please notify us immediately and destroy the message and its attachments. -----Original Message----- From: [email protected] [mailto:[email protected]] Sent: Monday, July 25, 2011 12:01 AM To: [email protected] Subject: Digest list: Daily messages from mailing list : 1. draft of scripting class examples for today's class ["Chip Orange" <[email protected]>] 2. guest speaker for scripting class on August 7 ["Chip Orange" <[email protected]>] Messages: ---------------------------- Message 1 ---------------------------- From: "Chip Orange" <[email protected]> To: <[email protected]> Reply-To: [email protected] Subject: draft of scripting class examples for today's class ' Draft Scripting class 21 (7/24/2011) ' these examples cover the use, and creation of, shared objects ' example 1 ' example showing the use of a sharedObject from the GW toolkit which is not an object, but just a function ' This example returns a string containing the text "edit box" dim objWindowType set objWindowType = SharedObjects.get("com.GWMicro.GWToolkit.WindowType") ' above, sharedObjects is a root level object which only has 3 methods: get, register, and revoke ' the variable objWindowType, although it looks like we assigned it an object, actually holds only a reference to a function msgBox "The name for window type 12 is " & objWindowType(12) ' "get" is the default method of the sharedObjects object, and so you can actually leave it off altogether as in the line below set objWindowType = SharedObjects("com.GWMicro.GWToolkit.WindowType") ' if you're using the "get" method of the sharedObjects object, below is a much better form to use in your app ' "get" has an optional second parameter, which is the number of milliseconds it is to wait for the object you want to become available; ' since use of "get" will pause your app while waiting, it's best to specify the wait time, so you can continue and let the user know a needed shared object is not available set objWindowType = nothing set objWindowType = SharedObjects.get("com.GWMicro.GWToolkit.WindowType", 10*1000) ' waits up to 10 seconds (the default is 30) if objWindowType is nothing then msgBox "Could not get a needed shared object" else ' here you go on to do whatever your app does knowing it got the shared object it needs end if ' end of example 1 ' example 2 ' here's the recommended way to get a shared object, by making use of the event which tells you when each shared object is available. ' It also demonstrates use of the executeGlobal command. Dim errorReportingEnabled errorReportingEnabled = False ' now connect to the onStateChange event of the sharedObjects object (which is a root level property). ConnectEvent SharedObjects, "OnStateChange", "HandleStateChange" ' end of main body Function HandleStateChange(objName, objState) ' event handler for the onStateChange event of the sharedObjects object. ' the first parameter is the name of the object, and the second is true if it's available, and false if not. ' this event gets triggered for each shared object when your app starts, as well as when new ones come online or go offline. HandleStateChange = False Select Case objName ' you only list CASE options for the objects you are interested in using ' even though you will receive a notification for all possible objects. Case "com.GWMicro.GWToolkit.ErrorReporting" If objState Then ' object is available ' (here you put the commands specific to use of this object when it is loaded) If Not errorReportingEnabled Then set objErrorReporting = SharedObjects(objName, 0) ' this too returns a simple function and not an object strErrCommands = objErrorReporting(ClientInformation.ScriptVersion, "[email protected]", True) ' which returns a string of VBScript commands ' the VBScript commands for error reporting primarily make use of the Script object's onError event ExecuteGlobal strErrCommands ' the executeGlobal command takes a string of VBScript commands, and treats them as if they were part of your app from the start; it inserts them into your app errorReportingEnabled = True End If else ' object has become unavailable (maybe it's script has crashed) ' so maybe you do something in your script such as undefine a hotkey which used this object, gray out some menu choices, whatever. end if end select HandleStateChange = True ' indicates you have handled this notification end function ' end of example 2 ' example 3: ' shows 3 different ways how to register your own object or function as a shared object ' 1: below is how the GW toolkit handles it's windowType shared object ' register a function in your app as a shared object SharedObjects.Register "com.GWMicro.GWToolkit.WindowType", GetRef("WindowType") Function WindowType(typeNum) ' ... end function ' 2: below is how the Homer library handles it's homer shared object ' register an object which is owned/created by the registering app ' and truly this single object is shared by all apps. ' (this is ok because there are no private variables in the class which need to be taylored to each app) SharedObjects.Register "org.NonvisualDevelopment.Homer", New Homer Class Homer ' Public methods ' Miscellaneous Public Function Append(sText) ' Append a line of XML to a wescriptui definition ' If InStr(sText, "<") Or InStr(sText, ">") Or InStr(sText, "&") Or InStr(sText, ";") Or InStr(sText, Chr(34)) Then Exit Function If InStr(sText, "&") Or InStr(sText, ";") Or InStr(sText, Chr(34)) Then Exit Function sDialogXml = sDialogXml & sText & vbCrLf End Function ' ... end class ' 3: below is how the GW toolkit handles it's standardHelpDialog shared object ' register an object, which contains a method for creating a "new" object which the calling app must use to create the object it needs ' before it can be used. Calling the method to create the new object gives each calling app it's own copy of the object. ' (note: the two objects here are not of the same type.) SharedObjects.Register "com.GWMicro.GWToolkit.StandardHelpDialog", New StandardHelpDialog ' notice the second parameter above is "new standardHelpDialog", which creates an object of type "standardHelpDialog" which is what is registered as the shared object, ' but there is only one of this object. ' when each user calls the newStandardHelpDialog method, they'll create their own object to work with. Class standardHelpDialog Public Function NewStandardHelpDialog() ' when the calling app calls this method, a new object with it's properties and methods etc. will get created in the thread of the calling app, not the registering app Set NewStandardHelpDialog = New standardHelpDialogClass End Function End Class ' below is the class the user really works with, after creating a new object of this type in their app by calling the .NewStandardHelpDialog method of the ' shared object. Class standardHelpDialogClass Public INIFileName Public INISectionName Public INIKeyName Public Hotkey Public HelpTitle Public HelpText Public KeyStrings Public ScriptName Public ScriptVersion Public UpdateUrl Public DefaultHotkeys Public FocusCloseButton Public UseAboutBox Public AboutAuthor Public AboutVersion Public AboutReleaseDate Public AboutCopyright Public AboutWebsite Public ShowHotkeysInHelp Public UseHotkeyManager Public ParentWindow ' ... End Class ' end of example 3 ' archives of these classes can be found at: ' https://www.gwmicro.com/App_Central/Developers/Interactive_Classes/ ---------------------------- Message 2 ---------------------------- From: "Chip Orange" <[email protected]> To: <[email protected]> Reply-To: [email protected] Subject: guest speaker for scripting class on August 7 Hi all, Jeff Bishop will be the guest speaker on August 7's scripting class (two weeks from today). He'll speak regarding all that he did to develop the WinAmp app. You'll be able to get a completely different point of view for once! We meet live on Sunday evenings at 7 pm EDT using TeamTalk. We have a TeamTalk file which specifies the TeamTalk server, channel name, and password; if anyone would like this file so you can join us live and ask Jeff questions, drop me a note at the email address below: [email protected] Otherwise, you'll be able to listen to the podcast from the GW scripting class archives at: https://www.gwmicro.com/App_Central/Developers/Interactive_Classes/ Chip
