The GW-Scripting list is a discussion list for information regarding the development and use of Window-Eyes scripts. Any subscriber of the GW-Scripting list has the ability to post on-topic messages.

From:

 "David" <elephant@tele2.no>

Subject:

 Connecting to multiple events?

Date:

 Wed, Jun 13, 2012 10:24:04 am
This is a multi-part message in MIME format.

------=_NextPart_000_00FB_01CD4980.F321E9E0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Something crossed my mind today. A bit of a techie question.

If I, in a script connect to multiple events, but want the same sub or function to be executed when any of the events take place. Kind of:

ConnectEvent ObjectName, "Event1", "happening"
ConnectEvent ObjectName, "Event2", "happening"

Function Happening()
Speak "something has happened."
End Function 'Happening.

Long as either of the events 1 or 2 takes place at different times, I guess the above code would work. (sure, with real names, of course.) But what if the two events take place at the same time? Is there any "life-line" that secures that events don't fire simultaneously? I guess not. So in a case like above, will I actually have to make two different eventHandling functions, with the exact same content (good thing we have copy and paste, smile)? Or, is there a safe way of handling a situation like this, with one "common" EventHandler?

Thanks for any input.

------=_NextPart_000_00FB_01CD4980.F321E9E0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.19222">
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2 face=Arial>Something crossed my mind today. A bit of a techie
question.</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT size=2 face=Arial>If I, in a script connect to multiple events, but
want the same sub or function to be executed when any of the events take place.
Kind of:</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT size=2 face=Arial>ConnectEvent ObjectName, "Event1",
"happening"</FONT></DIV>
<DIV><FONT size=2 face=Arial>ConnectEvent ObjectName, "Event2",
"happening"</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT size=2 face=Arial>Function Happening()</FONT></DIV>
<DIV><FONT size=2 face=Arial>&nbsp;&nbsp;&nbsp; Speak "something has
happened."</FONT></DIV>
<DIV><FONT size=2 face=Arial>End Function 'Happening.</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT size=2 face=Arial>Long as either of the events 1 or 2 takes place at
different times, I guess the above code would work. (sure, with real names, of
course.) But what if the two events take place at the same time? Is there any
"life-line" that secures that events don't fire simultaneously? I guess not. So
in a case like above, will I actually have to make two different eventHandling
functions, with the exact same content (good thing we have copy and paste,
smile)? Or, is there a safe way of handling a situation like this, with one
"common" EventHandler?</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT size=2 face=Arial>Thanks for any input.</FONT></DIV>
<DIV>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_00FB_01CD4980.F321E9E0--