What I have done in several cases is use the position of the windows within the application's window hierarchy. For instance, I may check the Control ID and also make sure it is the first control (window) in the dialog. Most of the time, all controls within a dialog are at the same x level. Don Marang -------------------------------------------------- From: "Chris Kung" <Chris.Kung@xxxxxxxxxxxxxxxxxx> Sent: Monday, March 01, 2010 12:46 PM To: <jawsscripts@xxxxxxxxxxxxx> Subject: [jawsscripts] Re: GUI Objects with same control ID > Thanks for you input Soronel > Just to complicate matters the objects are of the same class (Edit) aswell > as having the same control ID. They perform different functions and so > require JAWS to say something different when focused on them. The only > unique identifier is the handle but that changes every time you load up a > new instance of the window. > > Out of interest does JAWS call some Window API to retrieve information > about the current application? I am quite interested as to how it all > works. > > Thanks > ----------------------------------------------------------- > Christopher Kung > Junior Technical Implementation Specialist > TrapezeGroup (UK) Limited > www.trapezegroup.co.uk > ----------------------------------------------------------- > > Keep the dates free - 18-20th May, 2010 > Join us in Manchester at the Radisson SAS Hotel for the 2010 UK User > Conference! > Registration is now open - http://www.trapezegroup.co.uk/2010uc/index.php > Take advantage of the Early-Bird rate - available until 19th March, 2010! > > > > Soronel Haetir <soronel.haetir@xxxxxxxxx> > Sent by: jawsscripts-bounce@xxxxxxxxxxxxx > 01/03/2010 16:12 > Please respond to > jawsscripts@xxxxxxxxxxxxx > > > To > jawsscripts@xxxxxxxxxxxxx > cc > > Subject > [jawsscripts] Re: GUI Objects with same control ID > > > > > > > If the windows are at least of different types you could do something > like the following: > > Const > SHARED_ID = 1234, > INTERNAL_ID1 = 2000, > INTERNAL_ID2 = 20001 > > int Function GetInternalId(Handle hWnd) > Var > string strClass, > int nID > > Let nID = GetControlID(hWnd) > Let strClass = GetWindowsClass(hWnd) > > If nID == SHARED_ID1 Then > If strClass == "SysTreeView32" Then > return INTERNAL_ID1 > Elif strClass ="SysListView32" Then > return INTERNAL_ID2 > EndIf > EndIf > > ; return 0 > EndFunction > > Note that I haven't tried entering this in the script editor so there > may be errors, it's only meant to illustrate the idea of using > whatever unique information is available to assign an easier value for > matching purposes. After writing the above function you could do > something like the following: > > void Function SomeEventHandler(Handle hWnd) > var > int nID > ... > > Let nID = GetInternalID(hWnd) > If nID == SHARED_ID1 Then > ... > ElIf nID == SHARED_ID2 Then > ... > EndIf > EndFunction > > > Also, if the class/ID pair is unique within a context you can use > FindWindowWithClassAndId to get a handle to it. > > On 3/1/10, Chris Kung <Chris.Kung@xxxxxxxxxxxxxxxxxx> wrote: >> Hi Everyone >> I work for a company that provides software to transport divisions. >> >> I've been trying to get my head round JAWS scripting to get our >> application to up to scratch but I've encountered some problems. >> >> The main issue is that we have certain objects with the same control ID, >> thus when it comes to scripting its difficult to distinguish between the >> two objects. >> >> One idea was get the screen position of the object and unique identify > it >> that way but I haven't got a clue on how to do this. >> >> Has anyone here experienced similar problems? >> >> Thanks >> ----------------------------------------------------------- >> Christopher Kung >> Junior Technical Implementation Specialist >> TrapezeGroup (UK) Limited >> www.trapezegroup.co.uk >> ----------------------------------------------------------- >> >> Keep the dates free - 18-20th May, 2010 >> Join us in Manchester at the Radisson SAS Hotel for the 2010 UK User >> Conference! >> Registration is now open - > http://www.trapezegroup.co.uk/2010uc/index.php >> Take advantage of the Early-Bird rate - available until 19th March, > 2010! >> >> __________ >> Visit and contribute to The JAWS Script Repository > http://jawsscripts.com >> >> View the list's information and change your settings at >> //www.freelists.org/list/jawsscripts >> >> > > > -- > Soronel Haetir > soronel.haetir@xxxxxxxxx > __________ > Visit and contribute to The JAWS Script Repository http://jawsscripts.com > > View the list's information and change your settings at > //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 > //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 //www.freelists.org/list/jawsscripts