[jawsscripts] Re: GUI Objects with same control ID

  • From: Soronel Haetir <soronel.haetir@xxxxxxxxx>
  • To: jawsscripts@xxxxxxxxxxxxx
  • Date: Mon, 1 Mar 2010 07:11:35 -0900

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

Other related posts: