Hello Chip,

Well, I've got some good news and some bad news.

The good news is I can duplicate the problem. The bad news is it is a bug in Window-Eyes that we have already fixed for the next release. More good news is I have an easy work around for you in the mean time.

The problem is if the optional process parameter is passed by reference then it will fail. This is our bug that we just fixed. To work around this pass the parameter by value instead of by reference. To do this simply modify your script to pass in the window to your blockAllMSAAEvents sub you are interested in instead of the process. Then call BlockEvent with window.process. This forces the parameter to be by value and it will work.

But also, you have a bug in your script. You are not saving the BlockEvent return value to a variable. Because of this the block gets set but them immediately cleared. If you don't save the return value or the variable you set it to loses scope then the block is removed. So you will need to update this as well. But this will get you going.

Good luck!

Regards,
Doug



Chip Orange wrote:
Yes sir, no garb script below:


' 11/3/09
' script demonstrates that msaa blockEvent seems to be broken?
option explicit

testOutlook ' only tests blockEvent



sub testOutlook
' test using outlook (only tests blockEvent)

dim loWindows, loMPProcess
Set loWindows = DesktopWindow.Children.FilterByTitle ("inbox", fmStartsWith,
false)
if loWindows.count > 0 then
dim loMPWindow
set loMPWindow = loWindows(1)
if loMPWindow is nothing then
speak "internal error: unable to get inbox window"

else '  loMPWindow is nothing
' try using it's overlap
if loMPWindow.overlap is nothing then
speak "cannot use overlap"
else
set loMPWindow = loMPWindow.overlap
end if
set loMPProcess = loMPWindow.process
if loMPProcess is nothing then
speak "internal error: unable to get inbox process"

else
' block all MSAA events from this process
 blockAllMSAAEvents loMPProcess
end if
end if '  loMPWindow is nothing

else '  loWindows.count > 0
speak "internal error: unable to get inbox window"
end if '  loWindows.count > 0

end sub



sub blockAllMSAAEvents (forProcess)
' tell window eyes to ignore all MSAA activity from a given process.

dim i,x

set x = msaaEventSource
msgbox forprocess.executablePath

for i = event_SYSTEM_SOUND   to event_SYSTEM_MINIMIZEEND ' first group
 x.blockEvent  i, forProcess
next

for i = event_CONSOLE_CARET to event_CONSOLE_END_APPLICATION ' second group
x.blockEvent  i, forProcess
next

for i = event_OBJECT_SHOW to  event_OBJECT_CONTENTSCROLLED ' third and last
group
x.blockEvent  i, forProcess
next


end sub
-----Original Message-----
From: Doug Geoffray [mailto:[email protected]] Sent: Tuesday, November 03, 2009 1:07 PM
To: [email protected]
Subject: Re: getting error when trying to block msaa event

Chip,

So I can try and duplicate your issue how about giving me the outlook
script...and if possible, keep the script as simple as possible so we are
just focusing on the problem and not all the other garb the script may be
doing.

Thanks,
Doug

Chip Orange wrote:
        btw Doug,
        
        I rewrote my example program using outlook, and have the same
problem, so
        it's not mappoint that's the issue.
        
        I'm probably using blockEvent wrong, but as far as I know, I'm using
it the
        way the docs indicate.
        
        thanks again,
        
        Chip
        -----Original Message-----
From: Chip Orange [mailto:[email protected]] Sent: Monday, November 02, 2009 9:16 PM
        To: [email protected]
        Subject: RE: getting error when trying to block msaa event
        
        thanks Doug.
        
        I get the variable by searching for the MS mappoint window, and when
I find
        it, I use it's process property.  I msgbox the module name and
executable
        info from this process to make sure it's indicating ms mappoint
before I
        then try to use blockevent.
        
        how does this all sound?  I'll post an example program below:
        
                '-- Open the Map Point application and get an object
reference to
        it.
        set goMPApp = nothing
        dim goMPApp
                on error Resume next
        Set     goMPApp = createobject("MapPoint.Application")
        ON ERROR goto 0
        IF not (goMPApp is Nothing) then
        loadClassInformation goMPApp
        'if debugging then speakAlert "using MapPoint version " &
goMPApp.version '
        get MapPoint window dim loWindows Set loWindows =
        DesktopWindow.Children.FilterByTitle ("Map - Microsoft MapPoint",
        fmStartsWith, false) if loWindows.count > 0 then dim goNPWindow set
        goMPWindow = loWindows(1) dim goMPProcess set goMPProcess =
        goMPWindow.process if goMPProcess is nothing then speak "internal
error:
        unable to get MapPoint process"
        
        else
        ' block all MSAA events from this process because they trigger a bug
in
        window eyes (7.11) causing it to speak the focused item repeatedly
and
        non-stop.
        ' it appears to be the MapPoint .findNearBy method, called in a
repeating
        loop, which is causing MapPoint to generate the MSAA events.
        ' my guess is that this is causing a lot of window updating activity
for the
        hidden MapPoint window, and some of it is eroneously triggering WE
to speak.
        sleep 2*1000
        
         blockAllMSAAEvents goMPProcess
        
        end if
        
        else '  loWindows.count > 0
        speak "internal error: unable to get MapPoint window"
        end if '  loWindows.count > 0
        
        ' minimize MapPoint
        goMPApp.WindowState = geoWindowStateMinimize ' 1 ' hide the window
        goMPApp.Visible = FALSE goMPApp.userControl = false
        
        
        
        goMPApp.PaneState = geoPaneNone ' 3
                '-- Map Point only lets us have one map open, so create our
map
object '-- reference now.
        dim goMap
        Set goMap = goMPApp.ActiveMap
        'turn off optional rendering to increase performance
         goMap.BasicRenderingOnly()
        goMap.Altitude = 1  ' make the active map zoom into a small scale
view ' set
        up routing directions goMap.MapStyle = 0 ' road map
        goMap.ActiveRoute.DriverProfile.IncludeRefuelWarnings = FALSE
        goMap.ActiveRoute.DriverProfile.IncludeRestStops = FALSE ' make all
place
        categories visible dim j FOR J = 1 TO goMap.PlaceCategories.Count
goMap.PlaceCategories(J).Visible = TRUE Next
        '-------------
        ' loop every 2 seconds to show problem.  execute loop for only 30
seconds
        
        dim i, oCurLoc, x
        set oCurLoc = goMap.GetLocation(30.5, -84.2)
        
        
        for i = 1 to 0
        set x = oCurLoc.findNearBy (2)
        sleep 2000
        next
        
        goMap.saved = true
        set goMPApp = nothing
        
        
        
        
        Else '  not (goMPApp is Nothing)
        speakAlert "Unable to Find MapPoint Installed on This Computer"
        err.clear
        End If '   not (goMPApp is Nothing)
        
        
        
        
        
        sub blockAllMSAAEvents (forProcess)
        ' tell window eyes to ignore all MSAA activity from a given process.
        
        dim i,x
        
        msgBox forProcess.moduleName
        
        
        set x = msaaEventSource
        
        for i = event_SYSTEM_SOUND   to event_SYSTEM_MINIMIZEEND ' first
group
         x.blockEvent  i, forProcess
        next
        
        for i = event_CONSOLE_CARET to event_CONSOLE_END_APPLICATION '
second group
        x.blockEvent  i, forProcess next
        
        for i = event_OBJECT_SHOW to  event_OBJECT_CONTENTSCROLLED ' third
and last
        group x.blockEvent  i, forProcess next
        
        
        end sub
        
        
        
        -----Original Message-----
        From: Doug Geoffray [mailto:[email protected]]
        Sent: Monday, November 02, 2009 3:59 PM
        To: [email protected]
        Subject: Re: getting error when trying to block msaa event
        
        Chip,
        
        I know you said you verified your forProcess variable is a process
but I
        would double check.  This works fine for me as long as the process
is valid.
        But if the process isn't valid then I get the error you are getting.
How
        did you verify forProcess is a process and what are you setting it
to?
        
        Doug
        
        Chip Orange wrote:
                Hi all,
                
                I guess this is really to GW:
                
                I'm getting an "invalid procedure call or argument" when I
try to block an msaa event from another process. I have first verified by displaying the name that my variable does hold a valid process. here are the lines I'm using:
                
                set x = msaaEventSource
                x.blockEvent  event_SYSTEM_SOUND, forProcess
                
                
                I also get the error if I don't make a copy of
msaaEventSource, but try to execute blockEvent from it.
                
                does anyone know why this is?
                
                I'm trying to work around another WE problem having to do
with possibly MSAA output from this process, this is getting
silly!
                
                thanks.
                
                Chip
                
                
        

Reply via email to