Hi Chip: I haven't tried using any tools yetother than the speak command and 
logging logic flow and the contents of variables to a text file for analyysis. 
I will give that some thought to try and figure out a plan using one of the 
tools which I downloaded yesterday in preparation for your next classes. I 
think I have the BlockEvent working in my VB.net script since when I bring up 
the CSharp Application the cursor nor tab keys seem to work as they did before 
I added the BlockEvent. I still can't seem to get the bloody Watch statement to 
work or I can't get the MSAAEventSource to trigger the on focus event to fire 
the event handler sub. I will play with it some more today along with my 
VBScript  I am now going through line by line based on the WEFramework. I am 
starting to get it. The Dictionary Objects to handle strings, the Help Dialog 
that comes up under the ScriptManager - not the one that comes up if something 
goes wrong during the running of the script I think, and I am starting to look 
into the ToolKit Shared Objects a little.I know that the MSAA stuff works fine 
in VBS since I used it to do a little scripting for VWD a few years ago.The 
reason I am folling around with VB.net is that it has access to all the .net 
framework which is a massive repository of powerfull tools involving everything 
from Database and other file construction, access and binding to Strongly Typed 
objects and killer UI setups using properties rather than xml layouts. Also, if 
it works in Vb.net it will likely work in Visual Web Developer which opens some 
interesting ideas about scripting during website processing or even website 
creation. It is just something GW has touted for many years but never had a 
real world example of. Their sample has a couple of things that give a good 
idea of how to try and handle things but they did not even associate their 
sample with an application so it is not as relevant   as it should have been as 
an example of an external script. For example, with no example of using the 
native VB.net controls, no MSAA Event Processing and not any other Application 
Specific hooks the sample is pretty much devoid of the hooks necessary to 
create a real script that works to expose an Applications more inaccessible 
objects. So, unless they tested external scripts beyond the samples they posted 
the ground is soft in my opinion and I am never quite sure if I am doing 
something wrong or if there is another problem with the external scripting 
package itself. If I get this puppy working I might post it up as a real-world 
sample of an external script in VB.net 2008 but that is a big if for now. Sorry 
this is so long but I managed a major headache last night after tearing my 
vb.net script apart and rebuilding it in several diferent configurations to try 
and get, and verify, the ProcessId, the BlockEvent and still, when it gets to 
the WatchEvent it just won't fire that blasted handler. So, it's another day - 
more vBScript and VB.net with trying out the new tools I downloaded thanks to 
your wiki.
Later and thanks for all your help and your classes:
Rick USA
  ----- Original Message ----- 
  From: Chip Orange 
  To: gw-scripting@gwmicro.com 
  Sent: Wednesday, March 30, 2011 9:19 PM
  Subject: RE: Need Help With MSAAEventSource Problem In External Script


  Hi Rick,

  have you used WEEvent to log the MSAA events to make sure onObjectFocus is 
getting called?

  I've never used this event, I've used the onObjectFocus for the window 
object, but maybe this isn't generating MSAA events for some reason?  WEEvent 
would tell you anyway.

  hth,

  Chip





------------------------------------------------------------------------------
  From: RicksPlace [mailto:ofbgm...@mi.rr.com] 
  Sent: Tuesday, March 29, 2011 7:00 PM
  To: gw-scripting@gwmicro.com
  Subject: Need Help With MSAAEventSource Problem In External Script


  Hi: I have a VB.net script working until I try and use the MSAAEventSource. 
  I had some hot keys code which I removed for clarity which are working. 
  I handled the MSAAEventSource the same way that the ClientInformation object 
was handled unless I missed something. 
  Everything other than the MSAAEventSource code seems to work fine. 
  Below is the code for trying to handle the MSAAEventSource and 
ClientInformation objects. 
  I pulled the ClientInformation code pretty much directly from the GW VB.net 
sample script.
  I am getting no errors or warnings but the 
  Private Shared Sub OnObjectFocus( Acc As WindowEyes.Accessible ) _
  Handles MSAAEventSource.OnObjectFocus
  Subroutine does not seem to be getting executed when I navigate around the 
associated application (CSharp Express 2008). 
  Can you spot anything I might be doing wrong in handling the MSAAEventSource 
to try and capture the OnObjectFocus event?

  BeginCopiedCode:
  Imports System.Diagnostics
  Imports System.Runtime.InteropServices
  Imports Windoweyes
  ' Note, outer class to hold required "Global" variables and start message 
pump.
  Public Class AppContext
  Inherits ApplicationContext
  Private Shared app As WindowEyes.Application
  Private Shared WithEvents clientInformation As WindowEyes.ClientInformation
  Private Shared WithEvents MSAAEventSource As WindowEyes.MSAAEventSource
  Private Shared Speech As WindowEyes.Speech
  Public Sub New()
  MyBase.New()
  SetUp.SetUp()
  End Sub
  Private Shared Sub OnObjectFocus( Acc As WindowEyes.Accessible ) _
  Handles MSAAEventSource.OnObjectFocus
  Speech.Speak( "Focus Set")
  Logger.WriteLine( "Should Have Spoken in OnObjectFocus sub" )
  Speech.Speak( "Focus Set")
  End Sub
  Private Shared Sub clientInformation_OnShutdown() Handles 
clientInformation.OnShutdown
  System.Windows.Forms.Application.Exit()
  End Sub
  ' The below is a nested class using outer class variables.
  Public Class SetUp
  Public Shared Sub SetUp()
  app = New WindowEyes.Application()
  Speech = app.Speech
  app.ClientIdentify(System.Diagnostics.Process.GetCurrentProcess().Id)
              clientInformation = app.ClientInformation
  clientInformation.ScriptName = "RicksWEComScript"
  clientInformation.ScriptDescription = "This is my test script." 
  clientInformation.ScriptHelp = "This is a help string in ClientInfo."
  MSAAEventSource= app.MSAAEventSource 
  Dim event_OBJECT_FOCUS As Long = &H8005
  MSAAEventSource.WatchEvent( event_OBJECT_FOCUS )
  End Sub
  End Class
  End Class
  EndCopiedCode:
  Note that some of the lines wrapped in this e-mail but are clean in the code 
editor.

  I hope you can help as things look correct - at least as far as I understand 
them so far but they just dont work to capture the OnObjectFocus event. 
  Thanks:
  Rick USA

Reply via email to