The GW-Scripting list is a discussion list for information regarding the development and use of Window-Eyes scripts. Any subscriber of the GW-Scripting list has the ability to post on-topic messages.
From:
RicksPlaceSubject:
External ScriptHex Enum Printed OutDate:
Sat, Apr 2, 2011 4:49:46 pmcharset="iso-8859-1"
Hi Chip: Well, it was bothering me so I just printed it out.
WindowEyes.MSAAEventID.event_OBJECT_FOCUS: 32773
TempInt is: 32773
In Hex: 8005
So it appears to hold the correct value.
Later and thanks for the idea.
If wrong that could been at the root of the problem indeed.
Rick USA
----- Original Message -----
From: Chip Orange
To: gw-scripting@gwmicro.com
Sent: Saturday, April 02, 2011 4:00 PM
Subject: RE: External Script RootModule code
It all looks good to me.
it's a straw to grasp at, but have you verified the value of the constant you're importing and working with to identify the event? I mean event_OBJECT_FOCUS should be 0x8005, and I'm not sure where you're getting the constant from, but could you check it to be sure it's coming up as this value? If it were wrong, you'd never receive the MSAA on_focus event.
Chip
------------------------------------------------------------------------------
From: RicksPlace [mailto:ofbgmail@mi.rr.com]
Sent: Saturday, April 02, 2011 3:31 PM
To: gw-scripting@gwmicro.com
Subject: External Script RootModule code
Here she blows:
If you want it without all the Logger statements or if you have any comments or questions post them up. I have devolved into listening to StarGate sg1 to clear my old brain... anyway.
BeginCopiedCode:
Imports System.Diagnostics
Imports System.Runtime.InteropServices
Public Module LaunchApp
Public MyApp As WindowEyes.Application
Public WithEvents MyClientInformation As WindowEyes.ClientInformation
Public WithEvents MyMSAAEventSource As WindowEyes.MSAAEventSource
Public blockFocusEvent As WindowEyes.MSAAEventBlock
Public Speech As WindowEyes.Speech
Public Sub Main()
Application.EnableVisualStyles()
Logger.WriteLine( "Enter Main Sub")
MyApp = New WindowEyes.Application()
Speech = MyApp.Speech
' Set Up the ClientInformation
Try
MyApp.ClientIdentify(System.Diagnostics.Process.GetCurrentProcess().Id )
MyClientInformation = MyApp.ClientInformation
MyClientInformation.ScriptName = "RicksWEComScript"
MyClientInformation.ScriptDescription = "This is my test script for the vb.net interface"
MyClientInformation.ScriptHelp = "This is a help string in ClientInfo."
Logger.WriteLine( "ClientInformation Initialized OK")
Catch ex As Exception
Logger.WriteLine( "ProblemInitializing ClientInformation in MainSub")
Logger.WriteLine( ex.ToString())
End Try
' Initialize MyMSAAEventSource and Filter on Process
Try
MyMSAAEventSource= MyApp.MSAAEventSource
MyMSAAEventSource.Process = MyClientInformation.ApplicationProcess
Logger.WriteLine( "MyMSAAEventSource Initialized and Filtered OK")
Catch ex As Exception
Logger.WriteLine( "Error initializing MSAAEventSource")
Logger.WriteLine( ex.ToString())
End Try
' Initialize the BlockFocusEvent
Try
BlockFocusEvent = MyMSAAEventSource.BlockEvent( WindowEyes.MSAAEventID.event_OBJECT_FOCUS, MyClientInformation.ApplicationProcess )
Logger.WriteLine( "BlockFocusEvent Initialized OK.")
Catch ex As Exception
Logger.WriteLine( "Error Initializing the BlockFocusEvent")
Logger.WriteLine( ex.ToString())
End Try
' Initialize the WatchEvent
Try
MyMSAAEventSource .WatchEvent( WindowEyes.MSAAEventID.event_OBJECT_FOCUS )
Logger.WriteLine( "MyMSAAEventSource.WatchEvent sub executed with no errors.")
Catch ex As Exception
Logger.WriteLine( "Error Initializing the WatchEvent")
Logger.WriteLine( ex.ToString())
End Try
Logger.WriteLine( "BeginList: Overlap Object to Main Module")
Dim TopWin As Object = _
MyClientInformation.Overlap
Logger.WriteLine( _
"ClassName: " & TopWin.ClassName)
Logger.WriteLine( _
"Handle: " & TopWin.Handle.ToString())
Logger.WriteLine( _
"ModuleName: " & TopWin.ModuleName)
Logger.WriteLine( _
"Name: " & TopWin.Name)
Logger.WriteLine( _
"OriginalClassName: " & TopWin.OriginalClassName)
Logger.WriteLine( _
"OriginalType: " & TopWin.OriginalType)
' Logger.WriteLine( _
' "Overlap: " & TopWin.Overlap)
Logger.WriteLine( _
"Process.ProcessID: " & TopWin.Process.ProcessID.ToString())
Logger.WriteLine( _
"Style: " & TopWin.Style.ToString())
Logger.WriteLine( _
"Title: " & TopWin.Title)
Logger.WriteLine( _
"Type: " & TopWin.Type.ToString())
Logger.WriteLine( "EndList: Overlap Object to Main Module")
Logger.WriteLine( "BeginList: ClientInformation.ApplicationProcess " )
Dim apObj As Object
Try
apObj = MyClientInformation.ApplicationProcess
Logger.WriteLine( "apObj Initialized OK." )
Catch ex As Exception
Logger.WriteLine( "Error Initializing= MyClientInformation.ApplicationProcess" )
Logger.WriteLine( ex.ToString())
End Try
Logger.WriteLine( _
"ProcessID: " & apObj.ProcessID.ToString())
Logger.WriteLine( _
"ModuleName: " & apObj.ModuleName)
Logger.WriteLine( _
"ExecutablePath: " & apObj.ExecutablePath)
Logger.WriteLine( _
"InternalName: " & apObj.InternalName)
Logger.WriteLine( _
"OriginalFilename: " & apObj.OriginalFilename)
Logger.WriteLine( _
"ProductName: " & apObj.ProductName)
Logger.WriteLine( _
"ProductVersion: " & apObj.ProductVersion)
Logger.WriteLine( "EndList: ClientInformation.ApplicationProcess " )
Logger.WriteLine( "RunPump Statement is next")
Application.Run(New AppContext)
End Sub
Private Sub MSAAEventFocus_OnObjectFocus( AccObj As WindowEyes.Accessible ) _
Handles MyMSAAEventSource.OnObjectFocus
If AccObj Is Nothing Then
Logger.WriteLine( "Hit: AccObj was nothing in sub")
Speech.Speak( "Hit in the focus sub")
Else
Logger.WriteLine( "Hit: AccObj was nothing")
Speech.Speak( "Hit in the focus sub")
End If
Speech.Speak( "Focus Set")
Logger.WriteLine( "Should Have Spoken in OnObjectFocus sub" )
If Not AccObj Is Nothing Then
AccObj.SimulateEvent( WindowEyes.MSAAEventID.event_OBJECT_FOCUS, WindowEyes.AccessibleProperty.apAll)
End If
End Sub
Private Sub clientInformation_OnShutdown() _
Handles MyClientInformation.OnShutdown
Speech.Speak( "Shutting Down Now, ByeBye")
Logger.WriteLine( "Shutting Down Now")
Application.Exit()
End Sub
Public Class AppContext
Inherits ApplicationContext
Public Sub New()
MyBase.New()
Logger.WriteLine( "The New Context Pump is initialized.")
End Sub
End Class
End Module
EndCopiedCode:
Hi Chip: Well, it was bothering me so I just printed it out.
WindowEyes.MSAAEventID.event_OBJECT_FOCUS: 32773
TempInt is: 32773
In Hex: 8005
So it appears to hold the correct value.
Later and thanks for the idea.
If wrong that could been at the root of the problem indeed.
Rick USA
----- Original Message -----
From: Chip Orange
To: gw-scripting@gwmicro.com
Sent: Saturday, April 02, 2011 4:00 PM
Subject: RE: External Script RootModule code
It all looks good to me.
it's a straw to grasp at, but have you verified the value of the constant you're importing and working with to identify the event? I mean event_OBJECT_FOCUS should be 0x8005, and I'm not sure where you're getting the constant from, but could you check it to be sure it's coming up as this value? If it were wrong, you'd never receive the MSAA on_focus event.
Chip
------------------------------------------------------------------------------
From: RicksPlace [mailto:ofbgmail@mi.rr.com]
Sent: Saturday, April 02, 2011 3:31 PM
To: gw-scripting@gwmicro.com
Subject: External Script RootModule code
Here she blows:
If you want it without all the Logger statements or if you have any comments or questions post them up. I have devolved into listening to StarGate sg1 to clear my old brain... anyway.
BeginCopiedCode:
Imports System.Diagnostics
Imports System.Runtime.InteropServices
Public Module LaunchApp
Public MyApp As WindowEyes.Application
Public WithEvents MyClientInformation As WindowEyes.ClientInformation
Public WithEvents MyMSAAEventSource As WindowEyes.MSAAEventSource
Public blockFocusEvent As WindowEyes.MSAAEventBlock
Public Speech As WindowEyes.Speech
Public Sub Main()
Application.EnableVisualStyles()
Logger.WriteLine( "Enter Main Sub")
MyApp = New WindowEyes.Application()
Speech = MyApp.Speech
' Set Up the ClientInformation
Try
MyApp.ClientIdentify(System.Diagnostics.Process.GetCurrentProcess().Id )
MyClientInformation = MyApp.ClientInformation
MyClientInformation.ScriptName = "RicksWEComScript"
MyClientInformation.ScriptDescription = "This is my test script for the vb.net interface"
MyClientInformation.ScriptHelp = "This is a help string in ClientInfo."
Logger.WriteLine( "ClientInformation Initialized OK")
Catch ex As Exception
Logger.WriteLine( "ProblemInitializing ClientInformation in MainSub")
Logger.WriteLine( ex.ToString())
End Try
' Initialize MyMSAAEventSource and Filter on Process
Try
MyMSAAEventSource= MyApp.MSAAEventSource
MyMSAAEventSource.Process = MyClientInformation.ApplicationProcess
Logger.WriteLine( "MyMSAAEventSource Initialized and Filtered OK")
Catch ex As Exception
Logger.WriteLine( "Error initializing MSAAEventSource")
Logger.WriteLine( ex.ToString())
End Try
' Initialize the BlockFocusEvent
Try
BlockFocusEvent = MyMSAAEventSource.BlockEvent( WindowEyes.MSAAEventID.event_OBJECT_FOCUS, MyClientInformation.ApplicationProcess )
Logger.WriteLine( "BlockFocusEvent Initialized OK.")
Catch ex As Exception
Logger.WriteLine( "Error Initializing the BlockFocusEvent")
Logger.WriteLine( ex.ToString())
End Try
' Initialize the WatchEvent
Try
MyMSAAEventSource .WatchEvent( WindowEyes.MSAAEventID.event_OBJECT_FOCUS )
Logger.WriteLine( "MyMSAAEventSource.WatchEvent sub executed with no errors.")
Catch ex As Exception
Logger.WriteLine( "Error Initializing the WatchEvent")
Logger.WriteLine( ex.ToString())
End Try
Logger.WriteLine( "BeginList: Overlap Object to Main Module")
Dim TopWin As Object = _
MyClientInformation.Overlap
Logger.WriteLine( _
"ClassName: " & TopWin.ClassName)
Logger.WriteLine( _
"Handle: " & TopWin.Handle.ToString())
Logger.WriteLine( _
"ModuleName: " & TopWin.ModuleName)
Logger.WriteLine( _
"Name: " & TopWin.Name)
Logger.WriteLine( _
"OriginalClassName: " & TopWin.OriginalClassName)
Logger.WriteLine( _
"OriginalType: " & TopWin.OriginalType)
' Logger.WriteLine( _
' "Overlap: " & TopWin.Overlap)
Logger.WriteLine( _
"Process.ProcessID: " & TopWin.Process.ProcessID.ToString())
Logger.WriteLine( _
"Style: " & TopWin.Style.ToString())
Logger.WriteLine( _
"Title: " & TopWin.Title)
Logger.WriteLine( _
"Type: " & TopWin.Type.ToString())
Logger.WriteLine( "EndList: Overlap Object to Main Module")
Logger.WriteLine( "BeginList: ClientInformation.ApplicationProcess " )
Dim apObj As Object
Try
apObj = MyClientInformation.ApplicationProcess
Logger.WriteLine( "apObj Initialized OK." )
Catch ex As Exception
Logger.WriteLine( "Error Initializing= MyClientInformation.ApplicationProcess" )
Logger.WriteLine( ex.ToString())
End Try
Logger.WriteLine( _
"ProcessID: " & apObj.ProcessID.ToString())
Logger.WriteLine( _
"ModuleName: " & apObj.ModuleName)
Logger.WriteLine( _
"ExecutablePath: " & apObj.ExecutablePath)
Logger.WriteLine( _
"InternalName: " & apObj.InternalName)
Logger.WriteLine( _
"OriginalFilename: " & apObj.OriginalFilename)
Logger.WriteLine( _
"ProductName: " & apObj.ProductName)
Logger.WriteLine( _
"ProductVersion: " & apObj.ProductVersion)
Logger.WriteLine( "EndList: ClientInformation.ApplicationProcess " )
Logger.WriteLine( "RunPump Statement is next")
Application.Run(New AppContext)
End Sub
Private Sub MSAAEventFocus_OnObjectFocus( AccObj As WindowEyes.Accessible ) _
Handles MyMSAAEventSource.OnObjectFocus
If AccObj Is Nothing Then
Logger.WriteLine( "Hit: AccObj was nothing in sub")
Speech.Speak( "Hit in the focus sub")
Else
Logger.WriteLine( "Hit: AccObj was nothing")
Speech.Speak( "Hit in the focus sub")
End If
Speech.Speak( "Focus Set")
Logger.WriteLine( "Should Have Spoken in OnObjectFocus sub" )
If Not AccObj Is Nothing Then
AccObj.SimulateEvent( WindowEyes.MSAAEventID.event_OBJECT_FOCUS, WindowEyes.AccessibleProperty.apAll)
End If
End Sub
Private Sub clientInformation_OnShutdown() _
Handles MyClientInformation.OnShutdown
Speech.Speak( "Shutting Down Now, ByeBye")
Logger.WriteLine( "Shutting Down Now")
Application.Exit()
End Sub
Public Class AppContext
Inherits ApplicationContext
Public Sub New()
MyBase.New()
Logger.WriteLine( "The New Context Pump is initialized.")
End Sub
End Class
End Module
EndCopiedCode:




