Hi Ron: I agree about the language, verbose, cryptic and not intuitive at all
for this old Applications Programmer.
Besides, I have a Vb.net Script (App) working so far and it handles OnFocus and
OnShutdown very well indeed.
It still needs some testing and the Form1 grabs focus sometimes even though
hidden.
I'll see how to work around that tomorrow - might not need a form to start a
message pump.
So far so good Indeed!
Rick USA
----- Original Message -----
From: Ron Parker
To: [email protected]
Sent: Friday, April 13, 2012 4:29 PM
Subject: Re: WE And Microsoft Development Environments
Window-Eyes isn't WSH. Both Window-Eyes and WSH are ActiveScript script
hosts, and we leveraged the WSF file format to allow our encrypted scripts to
be signed, but that's the only relationship between Window-Eyes and WSH.
You're right about PowerShell, though: it's embeddable, but only in managed
code for now. Since Window-Eyes is and will likely remain unmanaged code, it
can't have PowerShell embedded until Microsoft makes that possible, assuming
they ever do.
However, you can use PowerShell apps with Window-Eyes. I have done so, and it
works. They just run in a separate process, as VB6, VB.net, C++, C#, Python,
and Perl apps also do. I can't say I'm a fan of the language, though; it seems
both incredibly verbose and unnecessarily cryptic at the same time.
On 4/13/2012 4:19 PM, Katherine Moss wrote:
PowerShell has no support for WSH, I don't think, and it is strictly .NET.
From: RicksPlace [mailto:[email protected]]
Sent: Friday, April 13, 2012 4:13 PM
To: [email protected]
Subject: Re: WE And Microsoft Development Environments
Hi Kate:
I threw Aaron's VB.net example together, fixed a missing piece of code from
the C# example and it compiled and ran without errors except...
The OnFocus event seemingly did not fire at all on this first go.
The Shutdown Event did fire properly.
I am testing the VB.net Script's Executable Assembly over the Microsoft
VWD Platform while I work on a VWD Project.
I will look at it some more tomorrow, run another test or 2 and see if I
can find something.
Otherwise I will contact Aaron to see what he thinks.
This might be the same problem I was having before, not sure, but if Aaron
tested his scripts then it should work if I get it right.
I wonder if GW could add that PowerShell scripting language to the WEEngine
like VBS and I think JavaScript without too much trouble.
That way it would not be an external script but have full access to the
.net Framework.
That said, I just dont know how that works so cant even guess if it is a
big job or even possible.
Later and good hunting!
Rick USA
----- Original Message -----
From: Katherine Moss
To: [email protected]
Sent: Friday, April 13, 2012 3:54 PM
Subject: RE: WE And Microsoft Development Environments
This looks like we're making some progress, and it looks like I do have
something else to shoot for besides networking-based applications (which is the
main reason for me learning C#.) Bu it would be interesting for PowerShell to
be introduced as another language for WE scripting support. And the funny
thing is that PowerShell is a scripting language, Microsoft's preference over
VBS anyway.
From: Aaron Smith [mailto:[email protected]]
Sent: Friday, April 13, 2012 10:44 AM
To: [email protected]
Subject: Re: WE And Microsoft Development Environments
Here's the VB version of my previous example:
Public Class Form1
Private weApplication As WindowEyes.Application
Private WithEvents weClientInformation As WindowEyes.ClientInformation
Private mySpeech As WindowEyes.Speech
Private myMSAAEventSource As WindowEyes.MSAAEventSource
Private Sub Form1_Load(sender As System.Object, e As
System.EventArgs) Handles MyBase.Load
weApplication = New WindowEyes.Application
weApplication.ClientIdentify(System.Diagnostics.Process.GetCurrentProcess().Id)
weClientInformation = weApplication.ClientInformation
AddHandler weClientInformation.OnShutdown, AddressOf
Me.weClientInformation_OnShutdown
Me.Hide()
End Sub
Private Sub myMSAAEventSource_OnObjectFocus(accObj As
WindowEyes.Accessible)
Dim handeledEvent As Boolean = False
Try
accObj.Prefetch(WindowEyes.AccessibleProperty.apAll)
If accObj.role.Value =
WindowEyes.AccessibleRoleEnum.role_SYSTEM_PUSHBUTTON Then
mySpeech.Speak(accObj.Name & ". I has a button!")
End If
Catch ex As Exception
' Something bad happened
End Try
If Not handeledEvent Then
accObj.SimulateEvent(WindowEyes.MSAAEventID.event_OBJECT_FOCUS,
WindowEyes.AccessibleProperty.apAll)
End If
End Sub
Private Sub weClientInformation_OnShutdown()
Me.Close()
End Sub
End Class
Aaron
On 4/12/2012 6:40 PM, RicksPlace wrote:
Hi Aaron: I dont remember the exact problem. It might have been something
to do with that Message Processing problem I mentioned but I think you, or one
of the other guys, had mentioned that problem had been addressed so I'm not
sure that was the problem.
I think I still have that VB.net project floating around and will ReVisit
it.
If I get it working I will post it as another example of scripting WE
from within the Visual Studio (VB.net Express) environment.
If not I will post up any problems I encounter.
It might take a few days as I am tied up with something else but I will
give it another go before long.
Hay, you other folks who program are invited to give it a go in another
language. Kate, what about Power Basic?
Rick USA
----- Original Message -----
From: Aaron Smith
To: [email protected]
Sent: Thursday, April 12, 2012 3:49 PM
Subject: Re: WE And Microsoft Development Environments
On 4/11/2012 6:21 PM, RicksPlace wrote:
I never got MSAA working properly and had some other problems which I
couldn't resolve.
Do you remember what the issues were? I whipped up this example real
quick which demonstrates speaking "I has a button" any time a button accessible
gets focused:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using WindowEyes;
namespace MSAAEventProc {
public partial class MSAAEventProc : Form {
private WindowEyes.Application weApplication = null;
private WindowEyes.ClientInformation weClientInformation = null;
private WindowEyes.Speech mySpeech = null;
private WindowEyes.MSAAEventSource myMSAAEventSource = null;
public MSAAEventProc() {
Debug.WriteLine("init");
InitializeComponent();
// Get the application object
weApplication = new WindowEyes.Application();
// Introduce ourselves to Window-Eyes
weApplication.ClientIdentify(System.Diagnostics.Process.GetCurrentProcess().Id);
weClientInformation = weApplication.ClientInformation;
// Hook Shutdown so we can clean up
weClientInformation.OnShutdown += new
ClientInformationEvents_OnShutdownEventHandler(weClientInformation_OnShutdown);
// Hook MSAA events
myMSAAEventSource = weApplication.MSAAEventSource;
myMSAAEventSource.OnObjectFocus += new
MSAAEvents_OnObjectFocusEventHandler(myMSAAEventSource_OnObjectFocus);
// Set up Speech so we can talk
mySpeech = weApplication.Speech;
}
private void
myMSAAEventSource_OnObjectFocus(WindowEyes.Accessible accObj) {
bool handeledEvent = false;
try {
// Prefetch all the Accessible info
accObj.Prefetch(AccessibleProperty.apAll);
// If it's a button, we'll handle it.
if (accObj.role.Value ==
AccessibleRoleEnum.role_SYSTEM_PUSHBUTTON) {
mySpeech.Speak(accObj.Name + ". I has a button!");
}
} catch (Exception e) {
// Something bad happened;
}
if (!handeledEvent) {
// Simulate the event
accObj.SimulateEvent(MSAAEventID.event_OBJECT_FOCUS,
AccessibleProperty.apAll);
}
}
private void weClientInformation_OnShutdown() {
// Bye
Close();
}
}
}
Aaron
-- Aaron Smith Web Development * App Development * Product Support SpecialistGW
Micro, Inc. * 725 Airport North Office Park, Fort Wayne, IN 46825260-489-3671 *
gwmicro.com To insure that you receive proper support, please include all
pastcorrespondence (where applicable), and any relevant informationpertinent to
your situation when submitting a problem report to the GWMicro Technical
Support Team.
-- Aaron Smith Web Development * App Development * Product Support SpecialistGW
Micro, Inc. * 725 Airport North Office Park, Fort Wayne, IN 46825260-489-3671 *
gwmicro.com To insure that you receive proper support, please include all
pastcorrespondence (where applicable), and any relevant informationpertinent to
your situation when submitting a problem report to the GWMicro Technical
Support Team.