[jawsscripts] Re: an issue with a function to find the tab handle, since the tab is on some weard place or of nonstandard, so help is requested.
- From: "Geoff Chapman" <gch@xxxxxxxxxxxxxxxx>
- To: <jawsscripts@xxxxxxxxxxxxx>
- Date: Mon, 9 Nov 2009 08:20:21 +1100
Hi Don.
Man I get reeeealy stupidly bogged down with emails here and I don't think I
ever read/saw this reply from you.
Thanks once again for the detail on why you did what you did in the code. I
did finish one lot of documentation work, but now have another lot to do, to
get out before I can really devote any kind of decent time to studying this,
but I'm going to file it away. I hope you do get to Aus some time, I
haven't ever been out of the country myself to do comparisons yet, but, from
what I hear from others, it seems like a very blessed country to be in, and
I'm very thankful to be here.
Thanks again for the explanation, and sorry for the discourtesy in not
acknowledging sooner.
oh BTW, in an email further on, I think I observed you saying hi to me, when
you were actually replying to an email from Jitendra. just to alert that
we are not one and the same person, <grin.> and I'd wager that Jitendra,
comes from another country totally than Australia! and is certainly tackling
jobs I myself have not yet dreamed of tackling.
<smile.>
Geoff c.
----- Original Message -----
From: "Donald Marang" <donald.marang@xxxxxxxxx>
To: <jawsscripts@xxxxxxxxxxxxx>
Sent: Monday, October 19, 2009 7:05 AM
Subject: [jawsscripts] Re: an issue with a function to find the tab handle,
since the tab is on some weard place or of nonstandard, so help is
requested.
> Hi Jeff,
>
> I only wrote that reusable function because the FindWindow function may
> return a window handle that is not visible. I attempted to use the
> FindWindow function in a simple While loop. I quickly discovered that the
> FindWindow performed the search at the last window and worked forward. My
> original loop assumed that the VMware Workstation application could have
> many "dialogs" (one for each Virtual Machine) that contain at least one
> window of the class which is being searched. Only the "dialog" and its
> controls for the active Virtual Machine would be visible. If the first
> FindWindow statement returned an invisible window, I went up a level in
the
> hierarchy (GetParent) and started the next FindWindow statement at the
next
> "dialog" which was the NextWindow at that level. Since it searched from
the
> bottom, my function would always only find the last window of that class.
> If that window was not visible, the function would fail.
>
> I could not easily get my head around modifying my While loops to work
> backwards, so I decided to walk through each window in the entire
> application and perform my own comparisons. By dropping the FindWindow
> statement and searching through every window,my function became much more
> reusable since it no longer depends on a particular structure of the
> application's windows. I suppose, I could tweak the function further to
> make it even more reusable and functional and call it FindVisibleWindow,
> with the same parameters as FindWindow, but only return visible windows.
>
> Always glad to help the Ausies! I am here in the US, but I am currently
> using the Lee Real Solo Direct voice with JAWS 11 beta. My default voice
in
> JAWS 10 is Karen. I always wanted to visit Australia!
>
> Don Marang
>
> ----- Original Message -----
> From: "Geoff Chapman" <gch@xxxxxxxxxxxxxxxx>
> To: <jawsscripts@xxxxxxxxxxxxx>
> Sent: Sunday, October 18, 2009 10:02 AM
> Subject: [jawsscripts] Re: an issue with a function to find the tab
handle,
> since the tab is on some weard place or of nonstandard, so help is
> requested.
>
>
> > wow Don this code looks amazing!
> >
> > well, amazing to me at any rate. Thank you soooo much for sharing this.
> > I've always wanted to see some examples of how people like tool through
an
> > application looking for windows, if their control ID's changed too
> > dynamically to enable one to just grab it using those, which seems to me
> > to
> > be mostly the case these days. so just wanted to say a huge thanks for
> > posting this. I haven't tried to study it yet, but, after this week and
I
> > finish documentation for this job I did months ago, I'm going to set
> > myself
> > a task of trying to spend time every week trying to learn to understand
> > code
> > examples just like this, that I see up here to solve particular problems
> > etc. it's the only way I think I'm ever gunna learn how to get better at
> > handling all this stuff.
> > thanks for all the help you try and give up here man. your efforts do
not
> > go unnoticed here in Aus.
> >
> >
> >
> > Geoff c.
> >
> >
> > From: "Donald Marang" <donald.marang@xxxxxxxxx>
> > To: <jawsscripts@xxxxxxxxxxxxx>
> > Sent: Thursday, October 15, 2009 4:29 AM
> > Subject: [jawsscripts] Re: an issue with a function to find the tab
> > handle,
> > since the tab is on some weard place or of nonstandard, so help is
> > requested.
> >
> >
> >> Hi Jitendra,
> >>
> >> I am not sure I quite understand your circumstance, so excuse me if I
am
> > way
> >> off base. Perhaps it would be easier to find this Tab Control by
> > searching
> >> or the specific class. You would need to use the Home Row utility or
BX
> > to
> >> find out the exact Class string assigned to that control. Let me know
if
> >> you need help with this task. Once you get the Class string, assign it
> >> to
> > a
> >> constant and use the FindWindow function, with the name string empty.
> > This
> >> might look as follows:
> >>
> >> Const
> >> TAB_CONTROL_CLASS = "BitmapTabCtrl" ; just my value used in the VMware
> >> Workstation
> >>
> >> Handle Function FindTab ()
> >> Var
> >> Handle hTab
> >>
> >> Let hTab = FindWindow (GetAppMainWindow (GetCurrentWindow ()),
> >> TAB_CONTROL_CLASS , "")
> >>
> >> I recently wrote a function for VMware Workstation that loops through
the
> >> entire application searching for the active window with the desired
class
> >> that is visible. I use it to get the handle for various classes such
as
> >> a
> >> Tab Control, Tree view, List view and even standard Edit and Button
> > classes.
> >> I attempted to repeditedly call FindWindow, but I think FindWindow
> > searches
> >> from the last window backward to the first window. Since my loop
starts
> > at
> >> the beginning, I just bypassed the FindWindow function and did the
> >> comparisons myself. Note that the function returns False (0), if
nothing
> >> was found.
> >>
> >> HANDLE Function MoveToClass (string sClass)
> >> Var
> >> Int iLoop,
> >> Int iDone,
> >> Handle hStart,
> >> Handle hSearch,
> >> Handle hWnd
> >>
> >> Let hStart = GetAppMainWindow (GetCurrentWindow ())
> >> ; SayMessage (OT_DEBUG, "hStart = " + IntToString (hStart))
> >> Let hWnd = GetFirstChild (hStart)
> >> Let iLoop = 1
> >> While ! iDone
> >> && iLoop < 1000
> >> ; SayMessage (OT_DEBUG, "loop = " + IntToString (iLoop))
> >> ; SayMessage (OT_DEBUG, "level = " + IntToString (GetWindowHierarchyY
> >> (hWnd)))
> >> ; SayMessage (OT_DEBUG, "child " + IntToString (GetWindowHierarchyX
> >> (hWnd)))
> >> If GetWindowClass (hWnd) == sClass Then
> >> ; Found desired class
> >> SayMessage (OT_DEBUG, sClass + " control found! iLoop = " +
> >> IntToString
> >> (iLoop))
> >> ; SayMessage (OT_DEBUG, "level = " + IntToString (GetWindowHierarchyY
> >> (hWnd)))
> >> ; SayMessage (OT_DEBUG, "child " + IntToString (GetWindowHierarchyX
> >> (hWnd)))
> >> If IsWindowVisible (hWnd) Then
> >> SayMessage (OT_DEBUG, "control is visible, handle = " + IntToString
> >> (hWnd))
> >> SetFocus (hWnd)
> >> Return hWnd
> >> Else
> >> SayMessage (OT_DEBUG, "control is NOT visible!")
> >> EndIf ; visibility check
> >> EndIf ; class found!
> >> ; traverse to next available window
> >> Let hSearch = GetFirstChild (hWnd)
> >> If hSearch Then
> >> ; move to child
> >> Let hWnd = hSearch
> >> Else
> >> Let hSearch = GetNextWindow (hWnd)
> >> If hSearch Then
> >> ; move to next window
> >> Let hWnd =hSearch
> >> Else
> >> ; last window in branch, go up as many levels as needed then to
next
> >> window
> >> Let hSearch = StringToHandle ("0") ; cause While loop to execute at
> > least
> >> once
> >> While ! hSearch
> >> && ! iDone
> >> Let hWnd = GetParent (hWnd)
> >> If hWnd == hStart Then
> >> ; Finished searching, nothing found!
> >> ; SayMessage (OT_DEBUG, "hWnd = hStart = " + IntToString (hWnd))
> >> Let iDone = True
> >> Else
> >> Let hSearch = GetNextWindow (hWnd)
> >> EndIf ; back to top level
> >> EndWhile
> >> Let hWnd = hSearch
> >> EndIf ; next window available
> >> EndIf ; child available
> >> Let iLoop = iLoop + 1
> >> EndWhile
> >> SayMessage (OT_DEBUG, "searched all " + IntToString (iLoop) + "
windows;
> >> Could not find any more " + sClass + " Controls!")
> >> Return False
> >> EndFunction
> >>
> >> Don Marang
> >>
> >>
> >> ----- Original Message -----
> >> From: "Jitendra" <jeet.invincible@xxxxxxxxx>
> >> To: <jawsscripts@xxxxxxxxxxxxx>
> >> Sent: Wednesday, October 14, 2009 10:00 AM
> >> Subject: [jawsscripts] an issue with a function to find the tab handle,
> >> since the tab is on some weard place or of nonstandard, so help is
> >> requested.
> >>
> >>
> >> > Hello friends, as subject says half of it, I have created a function
to
> >> > provide the handle for the tabstrip or the tab control class, since I
> >> > am
> >> > not much friendly with such things, your help is appriciated and
> > required.
> >> > the problem is that this function does not give the handle, so the
code
> >> > is below and help me out on it.
> >> > handle Function FindTab ()
> >> > Var
> >> > Int Icount,
> >> > Handle hwnd,
> >> > String SRealName
> >> > Let ICount=0
> >> > Let SRealName=GetWindowName (GetRealWindow (GetFocus ()))
> >> > ;Let SRealName=StringLower (SRealName)
> >> > If StringContains (SRealName, "Ctrl") ||
> >> > StringContains (SRealName, "Format") ||
> >> > StringContains (SRealName, "ToolBar") then
> >> > Let Hwnd=GetRealWindow (GetFocus ())
> >> > Let Hwnd=GetFirstChild (Hwnd)
> >> > ;since the GetWindowHierarchyX function returned 1 here, when the
focus
> >> > was on the tab strip, and in the homerow, this was the first window,
I
> >> > thaught it should work this way.
> >> > Return Hwnd
> >> > Elif StringContains (SRealName, "Disk") then
> >> > Let Hwnd=GetRealWindow (GetFocus ())
> >> > Let Hwnd=GetFirstChild (Hwnd)
> >> > While ICount < 3
> >> > Let Hwnd=GetNextWindow (Hwnd)
> >> > Let ICount=ICount+1
> >> > EndWhile
> >> > ;since the GetWindowHierarchyX function returned 1 here, when the
focus
> >> > was on the tab strip, and in the homerow, this was the fourth window,
I
> >> > thaught it should work this way.
> >> > Return Hwnd
> >> > Elif StringContains (SRealName, "BatchMode") then
> >> > Let Hwnd=GetRealWindow (GetFocus ())
> >> > Let Hwnd=GetFirstChild (Hwnd)
> >> > While ICount < 9
> >> > Let Hwnd=GetNextWindow (Hwnd)
> >> > Let ICount=ICount+1
> >> > EndWhile
> >> > ;since the GetWindowHierarchyX function returned 1 here, when the
focus
> >> > was on the tab strip, and in the homerow, this was the 10th window, I
> >> > thaught it should work this way.
> >> > Return Hwnd
> >> > EndIf
> >> > EndFunction
> >> > any light?
> >> > Thank you, Jitendra.
> >> > __________
> >> > Visit and contribute to The JAWS Script Repository
> > http://jawsscripts.com
> >> >
> >> > View the list's information and change your settings at
> >> > http://www.freelists.org/list/jawsscripts
> >> >
> >>
> >> __________
> >> Visit and contribute to The JAWS Script Repository
http://jawsscripts.com
> >>
> >> View the list's information and change your settings at
> >> http://www.freelists.org/list/jawsscripts
> >>
> >
> > __________
> > Visit and contribute to The JAWS Script Repository
http://jawsscripts.com
> >
> > View the list's information and change your settings at
> > http://www.freelists.org/list/jawsscripts
> >
>
> __________
> Visit and contribute to The JAWS Script Repository http://jawsscripts.com
>
> View the list's information and change your settings at
> http://www.freelists.org/list/jawsscripts
>
__________
Visit and contribute to The JAWS Script Repository http://jawsscripts.com
View the list's information and change your settings at
http://www.freelists.org/list/jawsscripts
Other related posts:
- » [jawsscripts] an issue with a function to find the tab handle, since the tab is on some weard place or of nonstandard, so help is requested. - Jitendra
- » [jawsscripts] Re: an issue with a function to find the tab handle, since the tab is on some weard place or of nonstandard, so help is requested. - Donald Marang
- » [jawsscripts] Re: an issue with a function to find the tab handle, since the tab is on some weard place or of nonstandard, so help is requested. - Jitendra
- » [jawsscripts] Re: an issue with a function to find the tab handle, since the tab is on some weard place or of nonstandard, so help is requested. - Donald Marang
- » [jawsscripts] Re: an issue with a function to find the tab handle, since the tab is on some weard place or of nonstandard, so help is requested. - Jitendra
- » [jawsscripts] Re: an issue with a function to find the tab handle, since the tab is on some weard place or of nonstandard, so help is requested. - Johannes Grib
- » [jawsscripts] Re: an issue with a function to find the tab handle, since the tab is on some weard place or of nonstandard, so help is requested. - Jitendra
- » [jawsscripts] Re: an issue with a function to find the tab handle, since the tab is on some weard place or of nonstandard, so help is requested. - Geoff Chapman
- » [jawsscripts] Re: an issue with a function to find the tab handle, since the tab is on some weard place or of nonstandard, so help is requested. - Jitendra
- » [jawsscripts] Re: an issue with a function to find the tab handle, since the tab is on some weard place or of nonstandard, so help is requested. - Geoff Chapman
- » [jawsscripts] Re: an issue with a function to find the tab handle, since the tab is on some weard place or of nonstandard, so help is requested. - Geoff Chapman
- » [jawsscripts] Re: an issue with a function to find the tab handle, since the tab is on some weard place or of nonstandard, so help is requested. - Jitendra
- » [jawsscripts] Re: an issue with a function to find the tab handle, since the tab is on some weard place or of nonstandard, so help is requested. - Donald Marang
- » [jawsscripts] Re: an issue with a function to find the tab handle, since the tab is on some weard place or of nonstandard, so help is requested. - Geoff Chapman