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:
Activating a window - help neededDate:
Sun, Jan 29, 2012 7:22:25 pmThis is a multi-part message in MIME format.
------=_NextPart_000_009A_01CCDEED.9FD4A370
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I am attempting to write a small app, that has a feature of ""Switching" to a given window that is already open on my computer. Let's just for the example say, that I have a Notepad window open on my system. My app scrolls through all the Children windows of the desktop, and finds the one for Notepad. I then let it derive the handle for that window. So far, the app works just fine.
The problem arises when I try to Activate, and Focus the newly found Window. I have been looking on a couple of other apps, that I thought could have lead me in right direction, but without any luck (they simply got too complicated for my brain). Then also, I have been spending a couple of hours with that App developers Reference under the Help menu in WE. Still I don't grasp why my app won't switch to the found window.
Here is the troublesome code, that I cannot get to work. What am I doing wrong? Maybe I am totally astray here? Thanks for your feedback:
Dim WinHandle
' My app search for the window I want, and fills in this variable with the Window Handle, just fine. I won't copy that few lines here.
' Then comes the section I apparently have got wrong:
Sleep 2000 'Just tried to give the app enough time here.
dim FWin: Set FWin = Desktop.Children.Find( WinHandle )
' This line, I thought, would find the correct window, and make it ready for activation.
FWin.Overlap.Activate
' To Activate the Window, or it's Overlap.
FWin.Focus
' I had hoped, this would have focused me on the actual window. But such is not the case.
Sleep 1000
' A last sleep command, just to let things settle.
End of code snip
------=_NextPart_000_009A_01CCDEED.9FD4A370
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.19170">
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2 face=Arial>I am attempting to write a small app, that
has a feature of ""Switching" to a given window that is already open on my
computer. Let's just for the example say, that I have a Notepad window open on
my system. My app scrolls through all the Children windows of the desktop, and
finds the one for Notepad. I then let it derive the handle for that window. So
far, the app works just fine.</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>The problem arises when I try to Activate, and
Focus the newly found Window. I have been looking on a couple of other apps,
that I thought could have lead me in right direction, but without any luck (they
simply got too complicated for my brain). Then also, I have been spending a
couple of hours with that App developers Reference under the Help menu in WE.
Still I don't grasp why my app won't switch to the found window. </FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>Here is the troublesome code, that I cannot get to
work. What am I doing wrong? Maybe I am totally astray here? Thanks for your
feedback:</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>Dim WinHandle</FONT></DIV>
<DIV><FONT size=2 face=Arial>' My app search for the window I want, and fills in
this variable with the Window Handle, just fine. I won't copy that few lines
here. </FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>' Then comes the section I apparently have got
wrong:</FONT></DIV>
<DIV><FONT size=2 face=Arial>Sleep 2000 'Just tried to give the app enough time
here.</FONT></DIV>
<DIV><FONT size=2 face=Arial>dim FWin: Set FWin = Desktop.Children.Find(
WinHandle )</FONT></DIV>
<DIV><FONT size=2 face=Arial>' This line, I thought, would find the correct
window, and make it ready for activation.<BR>FWin.Overlap.Activate</FONT></DIV>
<DIV><FONT size=2 face=Arial>' To Activate the Window, or it's
Overlap.<BR>FWin.Focus</FONT></DIV>
<DIV><FONT size=2 face=Arial>' I had hoped, this would have focused me on the
actual window. But such is not the case.<BR>Sleep 1000</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>' A last sleep command, just to let things
settle.</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>End of code snip</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV></BODY></HTML>
------=_NextPart_000_009A_01CCDEED.9FD4A370--
------=_NextPart_000_009A_01CCDEED.9FD4A370
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I am attempting to write a small app, that has a feature of ""Switching" to a given window that is already open on my computer. Let's just for the example say, that I have a Notepad window open on my system. My app scrolls through all the Children windows of the desktop, and finds the one for Notepad. I then let it derive the handle for that window. So far, the app works just fine.
The problem arises when I try to Activate, and Focus the newly found Window. I have been looking on a couple of other apps, that I thought could have lead me in right direction, but without any luck (they simply got too complicated for my brain). Then also, I have been spending a couple of hours with that App developers Reference under the Help menu in WE. Still I don't grasp why my app won't switch to the found window.
Here is the troublesome code, that I cannot get to work. What am I doing wrong? Maybe I am totally astray here? Thanks for your feedback:
Dim WinHandle
' My app search for the window I want, and fills in this variable with the Window Handle, just fine. I won't copy that few lines here.
' Then comes the section I apparently have got wrong:
Sleep 2000 'Just tried to give the app enough time here.
dim FWin: Set FWin = Desktop.Children.Find( WinHandle )
' This line, I thought, would find the correct window, and make it ready for activation.
FWin.Overlap.Activate
' To Activate the Window, or it's Overlap.
FWin.Focus
' I had hoped, this would have focused me on the actual window. But such is not the case.
Sleep 1000
' A last sleep command, just to let things settle.
End of code snip
------=_NextPart_000_009A_01CCDEED.9FD4A370
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.19170">
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2 face=Arial>I am attempting to write a small app, that
has a feature of ""Switching" to a given window that is already open on my
computer. Let's just for the example say, that I have a Notepad window open on
my system. My app scrolls through all the Children windows of the desktop, and
finds the one for Notepad. I then let it derive the handle for that window. So
far, the app works just fine.</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>The problem arises when I try to Activate, and
Focus the newly found Window. I have been looking on a couple of other apps,
that I thought could have lead me in right direction, but without any luck (they
simply got too complicated for my brain). Then also, I have been spending a
couple of hours with that App developers Reference under the Help menu in WE.
Still I don't grasp why my app won't switch to the found window. </FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>Here is the troublesome code, that I cannot get to
work. What am I doing wrong? Maybe I am totally astray here? Thanks for your
feedback:</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>Dim WinHandle</FONT></DIV>
<DIV><FONT size=2 face=Arial>' My app search for the window I want, and fills in
this variable with the Window Handle, just fine. I won't copy that few lines
here. </FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>' Then comes the section I apparently have got
wrong:</FONT></DIV>
<DIV><FONT size=2 face=Arial>Sleep 2000 'Just tried to give the app enough time
here.</FONT></DIV>
<DIV><FONT size=2 face=Arial>dim FWin: Set FWin = Desktop.Children.Find(
WinHandle )</FONT></DIV>
<DIV><FONT size=2 face=Arial>' This line, I thought, would find the correct
window, and make it ready for activation.<BR>FWin.Overlap.Activate</FONT></DIV>
<DIV><FONT size=2 face=Arial>' To Activate the Window, or it's
Overlap.<BR>FWin.Focus</FONT></DIV>
<DIV><FONT size=2 face=Arial>' I had hoped, this would have focused me on the
actual window. But such is not the case.<BR>Sleep 1000</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>' A last sleep command, just to let things
settle.</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>End of code snip</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV></BODY></HTML>
------=_NextPart_000_009A_01CCDEED.9FD4A370--




