Hi Chip: I messed with the Immediate Window yesterday to see if I could
figure out anything helpful but couldn't figure out anything that would
tell me if the WatchEvent was firing to return anything and wouldn't
know what to look for if it did return something using the Immediate
Tool. There might be other mechanisms to get around this problem as you
mentioned but that is not a good way to build an application. Not
knowing if there is a problem with my understanding of the programming
model or if there is a problem with the programming model itself would
be a perminant whole in my understanding of the scripting language and
may cause unpredictable problems downline which would not be found by me
if I don't know and don't know I don't know. Since the rest of the real
world seems to work in VBScript this is just a "Blue Sky" project until,
and unless, someone out there actually demonstrates to me that GW ahs a
MSAA model that works to handle MSAA Events. By the way, MSAA may not be
going away anytime soon in the MS DOM models from something I read about
a year ago. They intended to keep MSAA as the mechanism for handling
some of their controls like ListViews or TreeViews etc... I forget which
ones were mentioned in the article but I remember reading something
concerning that particular topic. It seems to me that since GW had to
modify the External Scripting Engine to fix an initial problem along
these lines earlier that they would have done some heavier testing of
using an External Script in some popular language prior to releasing the
current version of the model yet their example external script did not
seemingly use any, or much, event processing and no MSAA Event
Processing which is the fundemental method of processing events in the
Microsoft Event Driven model.
Well, that's all I have this morning. I have to take my wife to the
doctors and then I will watch and wait to see what I hear further on
this subject while continuing my research into VBScript using the
WEFramework as my initial learning tool - it is interesting and I am
learning allot about VBScript and the mindset behind this particular
script.
Later Chip and don't burn too many cells on VB.net - again it is just a
"blue sky" concept at this point or until someone with specific
experience chimes in.
See you later and thanks again Chip:
Rick USA
----- Original Message -----
*From:* Chip Orange <mailto:lists3...@comcast.net>
*To:* gw-scripting@gwmicro.com <mailto:gw-scripting@gwmicro.com>
*Sent:* Thursday, March 31, 2011 6:01 PM
*Subject:* RE: Need Help With MSAAEventSource Problem In External
Script
Rick,
it sounds like you're doing a great job, and just running into
normal development problems that we all hit.
if you don't want to try WEEvent, you could write this in VBScript
just to see if you're even getting the MSAA info you think you are.
WEEvent would have just done this for you and logged it into a test
file, but they're otherwise the same approach.
once you know you are getting the MSAA info, then it becomes a
question of something specific to an external script; but you don't
want to spend all your time toing down that road if you aren't even
getting the MSAA info.
If you're not getting it, could you use the window onObjectFocus
event instead? maybe not if you want to block WE's behavior, but I'm
not sure exactly why you're doing this, so it's just another route
you could possibly take if you had to.
hth,
Chip
------------------------------------------------------------------------
*From:* RicksPlace [mailto:ofbgm...@mi.rr.com]
*Sent:* Thursday, March 31, 2011 6:27 AM
*To:* gw-scripting@gwmicro.com
*Subject:* Re: Need Help With MSAAEventSource Problem In External
Script
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 <mailto:lists3...@comcast.net>
*To:* gw-scripting@gwmicro.com <mailto: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