[jawsscripts] Re: how to use MSAA
- From: Doug Lee <doug.lee@xxxxxxxxxxxxxxxx>
- To: jawsscripts@xxxxxxxxxxxxx
- Date: Fri, 10 Oct 2008 15:00:57 -0400
I actualy first got the idea of using GetObjectFromEvent this way from
Michael (Mick) Curran's JFWTechnical scripts. Basically, you pass a
window handle and an MSAA object ID and get a specific MSAA object
back for that window. The most useful object ID is ObjID_Client,
because it gives you the MSAA object corresponding to the actual
control represented by the window (a Role_System_List object for a
list window, etc.). The name GetObjectFromEvent is interesting
because I think this function acts more like the MSAA
AccessibleObjectFromWindow call than like the
AccessibleObjectFromEvent call, but I don't really know which one is
getting used under the hood in JAWS.
On Fri, Oct 10, 2008 at 02:35:07PM -0400, Jamal Mazrui wrote:
Doug Lee is the expert on that. <grin> Basically, that function lets
you get a reference to one of the MSAA objects associated with a window.
Normally, you want to get the client object.
Jamal
On Fri, 10 Oct 2008, Cohn,
Jonathan C [IT] wrote:
> Date: Fri, 10 Oct 2008 13:28:25 -0500
> From: "Cohn, Jonathan C [IT]" <Jonathan.C.Cohn@xxxxxxxxxx>
> Reply-To: jawsscripts@xxxxxxxxxxxxx
> To: "jawsscripts@xxxxxxxxxxxxx" <jawsscripts@xxxxxxxxxxxxx>
> Subject: [jawsscripts] Re: how to use MSAA
>
> Can you explain a little what the getObjectFromEvent function is doing?
>
> Thanks,
>
> Jon
>
> -----Original Message-----
> From: jawsscripts-bounce@xxxxxxxxxxxxx
> [mailto:jawsscripts-bounce@xxxxxxxxxxxxx] On Behalf Of Jamal Mazrui
> Sent: Friday, October 10, 2008 1:59 PM
> To: jawsscripts@xxxxxxxxxxxxx
> Subject: [jawsscripts] Re: how to use MSAA
>
> Below are MSAA related functions and scripts I pulled from a couple projects.
> Not sure, but I think the Nav* functions are intended for Java, though as I
> recall, the FSDN documentation does not make that clear.
>
> There are various ways of getting a starting MSAA object, as you know.
> You can then get the number of its children with the AccChildCount property,
> e.g., oParent.AccChildCount. a child item is the default property, so you
> can get children by looping from oParent(1) to oParent(iCount). If the
> children are "accessible objects" rather than "simple children," you may be
> able to use the same logic to examine their children -- not sure though.
>
> I hope this helps you get further. Let us know.
>
> Jamal
>
>
> Include "msaa.jsh"
>
> Int Function MSAAGetChildCount(Handle h) ;Get the number of MSAA children in
> the client area of a window Var Int i, Object o, Object oNull, String s
>
> Let o = GetObjectFromEvent(h, msaa_OBJID_CLIENT, 1, i) Let i =
> o.AccChildCount Let o = oNull Return i EndFunction
>
> String Function MSAAGetDefaultAction(Handle h) ;Get the MSAA default action
> Var Int i, Object o, Object oNull, String s
>
> Let o = GetObjectFromEvent(h, msaa_OBJID_CLIENT, 1, i) Let s =
> o.AccDefaultAction(0) Let o = oNull Return s EndFunction
>
> String Function MSAAGetDescription(Handle h) ; Get the MSAA description Var
> Int i, Object o, Object oNull, String s
>
> Let o = GetObjectFromEvent(h, msaa_OBJID_CLIENT, 1, i) Let s =
> o.AccDescription(0) Let o = oNull Return s EndFunction
>
> Int Function MSAAGetFocus(Handle h)
> ; Get the MSAA Focus of a subitem
> Var
> Int i, Int iReturn,
> Object o, Object oNull
>
> Let o = GetObjectFromEvent(h, msaa_OBJID_CLIENT, 1, i) Let iReturn =
> o.AccFocus(0)
>
> Let o = oNull
> Return iReturn
> EndFunction
>
> String Function MSAAGetHelp(Handle h)
> ;Get MSAA help text
> Var
> Int i,
> Object o, Object oNull,
> String s
>
> Let o = GetObjectFromEvent(h, msaa_OBJID_CLIENT, 1, i) Let s = o.AccHelp(0)
> Let o = oNull Return s EndFunction
>
> String Function MSAAGetInfo(Handle h)
> ;Get string of various MSAA information
> Var
> Int i, Int iCount, Int iFocus, Int iChildren, Object o, Object oNull, String
> sReturn, String sRole, String sName, String sValue, String sState, String
> sHelp, String sDescription, String sKeyboardShortcut, String sDefaultAction
>
> Let h = GetFocus()
> Let o = GetObjectFromEvent(h, msaa_OBJID_CLIENT, 1, i) Let iCount =
> o.AccChildCount(0) Let i = 0 While i <= iCount Let sRole =
> GetRoleText(o.AccRole(i)) If !StringIsBlank(sRole) Then Let sReturn = sReturn
> + "Role=" + sRole + "\n" EndIf Let sName = o.AccName(i) If
> !StringIsBlank(sName) Then Let sReturn = sReturn + "Name=" + sName + "\n"
> EndIf Let sValue = o.AccValue(i) If !StringIsBlank(sValue) Then Let sReturn =
> sReturn + "Value=" + sValue + "\n" EndIf Let iFocus = o.AccFocus(i) If iFocus
> Then Let sReturn = sReturn + "Focus=" + IntToString(iFocus) + "\n" EndIf Let
> sState = MSAAGetStateText(o.AccState(i)) If !StringIsBlank(sState) Then Let
> sReturn = sReturn + "State=" + sState + "\n" EndIf Let sHelp = o.AccHelp(i)
> If !StringIsBlank(sHelp) Then Let sReturn = sReturn + "Help=" + sHelp + "\n"
> EndIf Let sDescription = o.AccDescription(i) If !StringIsBlank(sDescription)
> Then Let sReturn = sReturn + "Description=" + sDescription + "\n" EndIf Let
> sKeyboardShortcut = o.AccKeyboardSh
or
> tcut(i) If !StringIsBlank(sKeyboardShortcut) Then Let sReturn = sReturn +
> "KeyboardShortcut=" + sKeyboardShortcut + "\n" EndIf Let sDefaultAction =
> o.AccDefaultAction(i) If !StringIsBlank(sDefaultAction) Then Let sReturn =
> sReturn + "DefaultAction=" + sDefaultAction + "\n" EndIf Let iChildren =
> o.AccChildCount(i) If iChildren Then Let sReturn = sReturn + "Children=" +
> IntToString(iChildren) + "\n" EndIf
> Let i = i + 1
> EndWhile
> Let o = oNull
> Return sReturn
> EndFunction
>
> String Function MSAAGetKeyboardShortcut(Handle h) ;Get MSAA keyboard shortcut
> Var Int i, Object o, Object oNull, String s
>
> Let o = GetObjectFromEvent(h, msaa_OBJID_CLIENT, 1, i) Let s =
> o.AccKeyboardShortcut(0) Let o = oNull Return s EndFunction
>
> String Function MSAAGetName(Handle h)
> ;Get MSAA name
> Var
> Int i,
> Object o, Object oNull,
> String s
>
> Let o = GetObjectFromEvent(h, msaa_OBJID_CLIENT, 1, i) Let s = o.AccName(0)
> Let o = oNull Return s EndFunction
>
> Int Function MSAAGetRole(Handle h)
> ; Get MSAA numeric role
> Var
> Int i, Int iReturn,
> Object o, Object oNull
>
> Let o = GetObjectFromEvent(h, msaa_OBJID_CLIENT, 1, i) Let iReturn =
> o.AccRole(0)
>
> Let o = oNull
> Return iReturn
> EndFunction
>
> String Function MSAAGetRoleString(Handle h) ;Get text of MSAA numeric role
> Return GetRoleText(MSAAGetRole(h)) EndFunction
>
> Int Function MSAAGetState(Handle h)
> ;Get MSAA numeric state
> Var
> Int i,
> Object o, Object oNull,
> String s
>
> Let o = GetObjectFromEvent(h, msaa_OBJID_CLIENT, 1, i) Let i = o.AccState(0)
> Let o = oNull Return i EndFunction
>
> String Function MSAAGetStateString(Handle h) ;Get MSAA state text Return
> GetStateText(MSAAGetState(h)) EndFunction
>
> String Function MSAAGetStateText(Int iBits) ;Get composite text of MSAA states
>
> Var
> string sReturn
>
> If iBits & msaa_state_unavailable then
> let sReturn = sReturn + "unavailable "
> endIf
> If iBits & msaa_state_selected then
> let sReturn = sReturn + "selected "
> endIf
> If iBits & msaa_state_focused then
> let sReturn = sReturn + "focused "
> endIf
> If iBits & msaa_state_pressed then
> let sReturn = sReturn + "pressed "
> endIf
> If iBits & msaa_state_checked then
> let sReturn = sReturn + "checked "
> endIf
> If iBits & msaa_state_mixed then
> let sReturn = sReturn + "mixed "
> endIf
> If iBits & msaa_state_readonly then
> let sReturn = sReturn + "readonly "
> endIf
> If iBits & msaa_state_hottracked then
> let sReturn = sReturn + "hottracked "
> endIf
> If iBits & msaa_state_default then
> let sReturn = sReturn + "default "
> endIf
> If iBits & msaa_state_expanded then
> let sReturn = sReturn + "expanded "
> endIf
> If iBits & msaa_state_collapsed then
> let sReturn = sReturn + "collapsed "
> endIf
> If iBits & msaa_state_busy then
> let sReturn = sReturn + "busy "
> endIf
> If iBits & msaa_state_floating then
> let sReturn = sReturn + "floating "
> endIf
> If iBits & msaa_state_marqueed then
> let sReturn = sReturn + "marqueed "
> endIf
> If iBits & msaa_state_animated then
> let sReturn = sReturn + "animated "
> endIf
> If iBits & msaa_state_invisible then
> let sReturn = sReturn + "invisible "
> endIf
> If iBits & msaa_state_offscreen then
> let sReturn = sReturn + "offscreen "
> endIf
> If iBits & msaa_state_sizeable then
> let sReturn = sReturn + "sizeable "
> endIf
> If iBits & msaa_state_moveable then
> let sReturn = sReturn + "moveable "
> endIf
> If iBits & msaa_state_selfvoicing then
> let sReturn = sReturn + "selfvoicing "
> endIf
> If iBits & msaa_state_focusable then
> let sReturn = sReturn + "focusable "
> endIf
> If iBits & msaa_state_selectable then
> let sReturn = sReturn + "selectable "
> endIf
> If iBits & msaa_state_linked then
> let sReturn = sReturn + "linked "
> endIf
> If iBits & msaa_state_traversed then
> let sReturn = sReturn + "traversed "
> endIf
> If iBits & msaa_state_multiselectable then let sReturn = sReturn +
> "multiselectable "
> endIf
> If iBits & msaa_state_extselectable then let sReturn = sReturn +
> "extselectable "
> endIf
> If iBits & msaa_state_alert_low then
> let sReturn = sReturn + "alert_low "
> endIf
> If iBits & msaa_state_alert_medium then
> let sReturn = sReturn + "alert_medium "
> endIf
> If iBits & msaa_state_alert_high then
> let sReturn = sReturn + "alert_high "
> endIf
> If iBits & msaa_state_protected then
> let sReturn = sReturn + "protected "
> endIf
> If iBits & msaa_state_valid then
> let sReturn = sReturn + "valid "
> endIf
> Let sReturn = StringTrimTrailingBlanks(sReturn) Return sReturn EndFunction
>
> String Function MSAAGetValue(Handle h)
> ;Get MSAA value
> Var
> Int i,
> Object o, Object oNull,
> String s
>
> Let o = GetObjectFromEvent(h, msaa_OBJID_CLIENT, 1, i) Let s = o.AccValue(0)
> Let o = oNull Return s EndFunction
>
> Int Function MSAASetSelection(Handle h, Int iState) ;Select subitems using
> MSAA Var Int i, Int iCol, Int iRow, Int iReturn, Object oNull, Object o,
> String sReturn
>
> If !h Then
> Let h = GetFocus()
> EndIf
>
> Let o = GetObjectFromEvent(h, msaa_OBJID_CLIENT, iState, i)
> o.AccSelect(iState, i)
>
> Let o= oNull
> Return iReturn
> EndFunction
>
> Script MSAAInfo()
> Var
> Int i, Int iCount,
> Handle h,
> Object o, Object oNull,
> String sText, String sRole, String sName, String sValue, String sState,
> String sHelp, String sDescription, String sKeyboardShortcut, String
> sDefaultAction
>
> SayString("MSAA info")
> Let h = GetFocus()
> Let o = GetObjectAtPoint(i, GetCursorCol(), GetCursorRow()) Let sRole =
> GetAccRole(h) Let sRole = GetRoleText(o.AccRole) If !StringIsBlank(sRole)
> Then Let sText = sText + "Role=" + sRole + "\n"
> EndIf
> Let sName = GetAccName(h)
> Let sName = o.AccName
> If !StringIsBlank(sName) Then Let sText = sText + "Name=" + sName + "\n"
> EndIf
> Let sValue = GetAccValue(h)
> Let sValue = o.AccValue
> If !StringIsBlank(sValue) Then Let sText = sText + "Value=" + sValue + "\n"
> EndIf Let sState = GetStateText(GetAccState(h)) Let sState =
> GetStateText(o.AccState) If !StringIsBlank(sState) Then Let sText = sText +
> "State=" + sState + "\n" EndIf Let sHelp = GetAccHelp(h) Let sHelp =
> o.AccHelp If !StringIsBlank(sHelp) Then Let sText = sText + "Help=" + sHelp +
> "\n"
> EndIf
> Let sDescription = GetAccDescription(h)
> Let sDescription = o.AccDescription
> If !StringIsBlank(sDescription) Then Let sText = sText + "Description=" +
> sDescription + "\n" EndIf Let sKeyboardShortcut = GetAccKeyboardShortcut(h)
> Let sKeyboardShortcut = o.AccKeyboardShortcut If
> !StringIsBlank(sKeyboardShortcut) Then Let sText = sText + "Hotkey=" +
> sKeyboardShortcut + "\n" EndIf Let sDefaultAction = GetAccDefaultAction(h)
> Let sDefaultAction = o.AccDefaultAction If !StringIsBlank(sDefaultAction)
> Then Let sText = sText + "DefaultAction=" + sDefaultAction + "\n" EndIf Let
> iCount = GetAccChildCount(h) Let iCount = o.AccChildCount If iCount Then Let
> sText = sText + "Children=" + IntToString(iCount) + "\n" EndIf Let sText =
> sText + "\n"
> Let i = 1
> While i <= iCount
> Let sRole = GetRoleText(o.AccRole(i))
> If !StringIsBlank(sRole) Then Let sText = sText + "Role=" + sRole + "\n"
> EndIf
> Let sName = o.AccName(i)
> If !StringIsBlank(sName) Then Let sText = sText + "Name=" + sName + "\n"
> EndIf
> Let sValue = o.AccValue(1)
> If !StringIsBlank(sValue) Then Let sText = sText + "Value=" + sValue + "\n"
> EndIf Let sState = GetStateText(o.AccState(i)) If !StringIsBlank(sState) Then
> Let sText = sText + "State=" + sState + "\n" EndIf Let sHelp = o.AccHelp(i)
> If !StringIsBlank(sHelp) Then Let sText = sText + "Help=" + sHelp + "\n"
> EndIf
> Let sDescription = o.AccDescription(i)
> If !StringIsBlank(sDescription) Then Let sText = sText + "Description=" +
> sDescription + "\n" EndIf Let sKeyboardShortcut = o.AccKeyboardShortcut(i) If
> !StringIsBlank(sKeyboardShortcut) Then Let sText = sText + "Hotkey=" +
> sKeyboardShortcut + "\n" EndIf Let sDefaultAction = o.AccDefaultAction(i) If
> !StringIsBlank(sDefaultAction) Then Let sText = sText + "DefaultAction=" +
> sDefaultAction + "\n" EndIf Let sText = sText + "\n"
> Let i = i + 1
> EndWhile
> Let o = oNull
> SayVirtual(sText)
> EndScript
>
> Script MSAAJump()
> Var
> Int i, Int iCount,
> Handle h,
> Object o, Object oNull, Object oParent,
> String sText, String sRole, String sName, String sValue, String sState,
> String sHelp, String sDescription, String sKeyboardShortcut, String
> sDefaultAction
>
> Let h = GetFocus()
> Let o = GetObjectAtPoint(i, GetCursorCol(), GetCursorRow()) Let iCount =
> o.AccChildCount If !iCount Then Let oParent = o.AccParent Let iCount =
> oParent.AccChildCount Let o = oParent EndIf If !iCount Then SayString("No
> options!") Else If !InputBox("Text:", "MSAA Jump", sMSAAJump) Then
> SayString("Cancel")
> Else
> Let i = 1
> While i <= iCount
> Let sName = o.AccName(i)
> If StringContains(StringLower(sName), StringLower(sMSAAJump)) Then
> o.AccSelect(1, i) Let i = iCount + 2 Else Let i = i + 1 EndIf EndWhile If i
> == iCount + 1 Then SayString("Not found!") PerformScript SayLine() EndIf
> EndIf EndIf Let o = oNull EndScript
>
> Int Function MSAAPick()
> Var
> Int i, Int iCount, Int iDefault, Int iLength, Int iReturn, Handle h, Object
> o, Object oChild, Object oNull, Object oParent, String sText, String sRole,
> String sName, String sValue, String sState, String sHelp, String
> sDescription, String sKeyboardShortcut, String sDefaultAction
>
> SayString("MSAA pick")
> Let h = GetFocus()
> Let o = GetObjectAtPoint(i, GetCursorCol(), GetCursorRow()) Let iCount =
> o.AccChildCount If !iCount Then Let oParent = o.AccParent Let iCount =
> oParent.AccChildCount Let o = oParent EndIf If !iCount Then SayString("No
> options!") Else Let iLength = StringLength(sMSAAPick) Let i = 1 While i <=
> iCount Let sName = o.AccName(i) If !iDefault && StringLength(sName) ==
> iLength && sName == sMSAAPick Then Let iDefault = i EndIf Let sText = sText +
> "|" + sName Let i = i + 1 EndWhile Let sText = StringChopLeft(sText, 1) ;Let
> iDefault = Max(1, StringSegmentIndex(sText, "|", sMSAAPick, VS_True)) Let
> iDefault = Max(1, iDefault) Let i = dlgSelectItemInList(sText, "Options",
> VS_False, iDefault) If !i Then
> SayString("Cancel")
> Else
> o.AccDoDefaultAction(i)
> Let sMSAAPick = StringSegment(sText, "|", i) Let iReturn = VS_True EndIf
> EndIf Let o = oNull Return iReturn EndFunction
>
>
> __________?
> 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
--
Doug Lee, Senior Accessibility Programmer
SSB BART Group - Accessibility-on-Demand
mailto:doug.lee@xxxxxxxxxxxxxxxx http://www.ssbbartgroup.com
"While they were saying among themselves it cannot be done,
it was done." --Helen Keller
__________
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
- References:
- [jawsscripts] how to use MSAA
- From: Cohn, Jonathan C [IT]
- [jawsscripts] Re: how to use MSAA
- From: Jamal Mazrui
- [jawsscripts] Re: how to use MSAA
- From: Cohn, Jonathan C [IT]
- [jawsscripts] Re: how to use MSAA
- From: Jamal Mazrui
Other related posts:
- [jawsscripts] how to use MSAA
- From: Cohn, Jonathan C [IT]
- [jawsscripts] Re: how to use MSAA
- From: Jamal Mazrui
- [jawsscripts] Re: how to use MSAA
- From: Cohn, Jonathan C [IT]
- [jawsscripts] Re: how to use MSAA
- From: Jamal Mazrui