Hi Octavian,
Found the module. Great stuff. An OOP attitude and loads of methods, too. IT seems like it is far nicer to code MSAA from Perl compared to VB or C plus plus, because the author has gone to great lengths to abstract away MSAA specific qurks.

Active State doesn't offer marginal Win32 modules like this MSAA thing on their site. I've been mostly using the standard reps and thus didn't know the module existed. I found the 1.0 version at:

http://www.bribes.org/perl/ppm/

and installed it using PPM without any problems. All of the bundled tools I've tried appear to work fine but as soon as I try to do my own code things will fall apart. I suppose it is just some newbie mistake like a small typo or me misunderstanding the docs as usual.

As the very first thing, I'm trying to wait for focus change events and print out the control name and role. So far I've got the following (hope these liens will not wrap):

use strict;
use warnings;
use Win32::OLE;
use Win32::ActAcc;
Win32::OLE->Initialize();
my $eventMonitor = Win32::ActAcc::createEventMonitor(1);

for(;;)
{ # Endless loop hit ctrl+c to terminate.
my $focusedObject = $eventMonitor->waitForEvent( +{event => EVENT_OBJECT_FOCUS() } );
  my $objectName = $focusedObject->get_accName();
my $objectRole = Win32::ActAcc::GetRoleText($focusedObject->get_accRole());
  print "$objectName $objectRole\n";
} # for

When running this perl thinks for a second or two and then blurts out:

WinError=000000b7 in EventMonitor_synch at C:/Perl/site/lib/Win32/ActAcc.pm line
150.

Err um, any chances of getting a human readable representation or knowing the cause?

Things I've tried so far include:

1. Actually looking in the file where the error occurred. Here's some relevant context, I think. I've marked the line number 150 with a label HERE:

our $ieh; # event monitor

sub IEH
{
   if (!defined($ieh))
   {
       $ieh = createEventMonitor(1);
   }
   $ieh;
}

########

sub createEventMonitor
{
   my $active = shift;
   HERE: my $rv = events_register($active);
   return $rv;
}

2. Part of the equation might also be related to the waitForEvents method. APparently I should have an EventMonitor so I thought I'd call createEventMonitor() to spawn my own. I'm not totally sure if this is right and or necessary, though. The documentation does hint at a default event cursor. But calling: Win32::ActAcc::waitForEvent() alone does not seem to make much of a difference.

Additionally, I've attempted pasting the sample code to wait for notepad:

$aoNotepad = $eh->waitForEvent(
 +{ 'event'=>EVENT_OBJECT_SHOW(),
    'name'=>qr/Notepad/,
    'role'=>ROLE_SYSTEM_WINDOW() }, 30);

substituting $eh with $eventMonitor. It crashes with the same error message as above.

3. I've tried commenting out everything in the loop body apart from the method waiting for the events. The result is still the same.

4. I'm running Windows XP and Active State Perl 5.8.6. XP supports Active Accessibility 2.0 natively and I do have a screen reader, Dolphin Supernova, running that also uses MSAA as one of the detection methods. SO in the worst case, MSAA 1.3 compliant methods won't work with 2.0 or the screen reader causes some side effects. Both explanations are very unlikely but I'm beginning to run out of ideas, <smile>, and thought I'd post some newbie Qs here, then.

With kind regards Veli-Pekka Tätilä ([EMAIL PROTECTED])
Accessibility, game music, synthesizers and programming:
http://www.student.oulu.fi/~vtatila/

Octavian Rasnita wrote:
Hi,

Search with search.cpan.org for Active Accessibility and you will se a
Perl module there for this.

It is something like Win32::GUI::ActAcc or something like that.

Teddy

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to