Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Accessibility Standard Library


  • Please log in to reply
39 replies to this topic
Sean
  • Members
  • 2462 posts
  • Last active: Feb 07 2012 04:00 AM
  • Joined: 12 Feb 2007

Call to nonexistent function.

Sorry. I have no idea why all prefixes were missing there. I fixed that. And I'll post the example for your request in the thread of ShellFolder().

ahklerner
  • Members
  • 1386 posts
  • Last active: Oct 08 2014 10:29 AM
  • Joined: 26 Jun 2006
I made this for myself. Thought I would share. You can add to script if you want.
/* api for acc.ahk
ACC_Hex( num )
ACC_Value_( pacc, sValue [ , idChild ] )
ACC_Name_( pacc, sName [ , idChild ] )
ACC_DoDefaultAction( pacc [ , idChild ] )
ACC_HitTest( pacc [ , x, y ] )
ACC_Navigate( pacc [ , dir, idChild ] )
ACC_Location( pacc [ , idChild ] )
ACC_Select( pacc [ , nFlags, idChild ] )
ACC_DefaultAction( pacc [ , idChild ] )
ACC_Selection( pacc )
ACC_Focus( pacc )
ACC_KeyboardShortcut( pacc [ , idChild ] )
ACC_HelpTopic( pacc [ , idChild ] )
ACC_Help( pacc [ , idChild ] )
ACC_State( pacc [ , idChild ] )
ACC_Role( pacc [ , idChild ] )
ACC_Description( pacc [ , idChild ] )
ACC_Value( pacc [ , idChild ] )
ACC_Name( pacc [ , idChild ] )
ACC_Child( pacc, idChild )
ACC_ChildCount( pacc )
ACC_Parent( pacc )
ACC_Query( pacc )
ACC_WinEventProc( hHook, event, hWnd, idObject, idChild, eventThread, eventTime )
ACC_UnhookWinEvent( hHook )
ACC_SetWinEventHook( eventMin, eventMax, pCallback )
ACC_GetStateText( nState )
ACC_GetRoleText( nRole )
ACC_WindowFromAccessibleObject( pacc )
ACC_AccessibleObjectFromWindow( [ hWnd, idObject ] )
ACC_AccessibleObjectFromPoint( [ x, y ] )
ACC_AccessibleObjectFromEvent( hWnd, idObject, idChild )
ACC_AccessibleChildren( pacc, varChildren )
ACC_Term( )
ACC_Init( )
*/

Posted Image
ʞɔпɟ əɥʇ ʇɐɥʍ

Sean
  • Members
  • 2462 posts
  • Last active: Feb 07 2012 04:00 AM
  • Joined: 12 Feb 2007

I made this for myself. Thought I would share. You can add to script if you want.

How did you parse it? I'm asking it as the function names are reversed.
Anyway, I added it to ACC.zip as a separate file. The same with COM.zip and IE.zip.
Thanks for taking your time for these.

ahklerner
  • Members
  • 1386 posts
  • Last active: Oct 08 2014 10:29 AM
  • Joined: 26 Jun 2006
lol in SciTE ^# is a hotkey to go to the previous paragraph...made a short little script that copies the selected text and saves it in a list...decided to use #a as my hotkey and the stupid cursor kept going back to the previous function so i used it to my advantage and just started from the bottom.. :)
i guess i could have added a sort command to the script...or Reversed them...

ps: it does not matter what order they are in anyway for me, as I just add them to my AHK Autohotkey.api file that is used by SciTE.(so i get the calltips with parameters)
Posted Image
ʞɔпɟ əɥʇ ʇɐɥʍ

RonFred
  • Guests
  • Last active:
  • Joined: --
As a new guy to autohotkey I thought I would try the scripts on this thread.

First: The scripts don't work without some sort of #include right? How do you guys skip this step? I use these include statements to avoid load errors:
#include e:\program files\AutoHotKey\Extras\Scripts\ACC.ahk
#include e:\program files\AutoHotKey\Extras\Scripts\COM.ahk

Once I get the script to load: I highlight some text and press my moulse MButton. But nothing happens. I can get a "MsgBox, got to here" message to load after the MButton press but no text to speech. On MS Vista do I need to install something? Shouldn't the test for "If Not psv:=COM_CreateObject("SAPI.SpVoice")" catch the error?

sinkfaze
  • Moderators
  • 6367 posts
  • Last active: Nov 30 2018 08:50 PM
  • Joined: 18 Mar 2008
Hey Sean,

I'm probably asking a question I'm not smart enough to know better than to ask, but is it possible to loop through all of the Accessible child elements on a web page? I've been banging my head against a wall trying to find a way to work with some intranet pages at my place of work that have been "upgraded" with Flash content. Here's the info on the page element I'm trying to manipulate from your nifty "ACC Spy":

<Child under cursor>
Name:		Search:
Value:		
Description:	
Role:		editable text
State:		focusable	(0x100000)
Help:		
HelpTopic:	
Keyboard:	
DefAction:	
(l,t,w,h):		124,324,146,17

It's the only 'editable text' flash object on the page. If I can even give that field focus with ACC so I can send it text I'd be content and it appears acc_Focus could do that for me, but I can't seem to crack how I can loop through the objects to find the right one. Is it even possible?

Sean
  • Members
  • 2462 posts
  • Last active: Feb 07 2012 04:00 AM
  • Joined: 12 Feb 2007

but is it possible to loop through all of the Accessible child elements on a web page?

As far as I can tell, there is no systematic way to obtain all accessible elements. You can use accNavigate for that purpose, but it's not guaranteed to retrieve all elements. BTW, why didn't use embeds function of DOM?
oWeb.document.embeds[n]


sinkfaze
  • Moderators
  • 6367 posts
  • Last active: Nov 30 2018 08:50 PM
  • Joined: 18 Mar 2008
One other question Sean, I was informed that ACC functionality has been wrapped into the COM Standard Library. I wanted to try converting your "ACC Spy" strictly to COM calls but the additional parameters of COM_AccessibleObjectFromWindow and COM_AccessibleChildren (for example) have gotten me a bit confused. Any hints you can give me on how to proceed?

Also, have all components of ACC.ahk been wrapped into the COM Standard Library?

Sean
  • Members
  • 2462 posts
  • Last active: Feb 07 2012 04:00 AM
  • Joined: 12 Feb 2007

but the additional parameters of COM_AccessibleObjectFromWindow and COM_AccessibleChildren (for example) have gotten me a bit confused.

What's confusing with them?

Also, have all components of ACC.ahk been wrapped into the COM Standard Library?

No, only ones that fit to COM.ahk.

sinkfaze
  • Moderators
  • 6367 posts
  • Last active: Nov 30 2018 08:50 PM
  • Joined: 18 Mar 2008

What's confusing with them?


Actually now that I look at it again, I was just confused in general. I was confusing COM_AccessibleChildren with being the equivalent of acc_Child, which doesn't appear to be implemented in the standard library, correct?

Right now I'm basically taking the easiest route to cannibalizing the concept behind the "ACC Spy" to develop some functionality for tank's announced web script recorder project. My main objective at this point is to obtain the state of the element under the mouse, with ACC that's pretty easy:

Acc_Init()
pacc := Acc_AccessibleObjectFromPoint()
pState:=(paccChild:=acc_Child(pacc, _idChild_)) ? acc_State(paccChild)
 : acc_State(pacc, _idChild_)
MsgBox % pState
Acc_Term()

Bear in mind that I've read nothing about the actual functionality of the ACC calls, just did a quick copy to obtain what I needed. :oops:

Would I be able to accomplish the same thing as the above with just COM?

Sean
  • Members
  • 2462 posts
  • Last active: Feb 07 2012 04:00 AM
  • Joined: 12 Feb 2007

Would I be able to accomplish the same thing as the above with just COM?

Not all applications supporting Accessibility are compatible with COM.ahk, and there were slight changes on the parameters between ACC.ahk and COM.ahk, so if you're not prepared to handle those yourself you'd better stick with ACC.ahk. Anyway, I already posted a code in COM/COM_L/COM_U.
<!-- m -->http://www.autohotke...c22923-426.html<!-- m -->

And, here is an example of COM_AccessibleObjectFromPoint() in COM_L/COM_U.
CoordMode, Mouse
MouseGetPos, x, y
If	oAcc := COM_AccessibleObjectFromPoint(x, y, idChild) 
	MsgBox % nState := oAcc.accState(idChild)


sinkfaze
  • Moderators
  • 6367 posts
  • Last active: Nov 30 2018 08:50 PM
  • Joined: 18 Mar 2008

Not all applications supporting Accessibility are compatible with COM.ahk, and there were slight changes on the parameters between ACC.ahk and COM.ahk, so if you're not prepared to handle those yourself you'd better stick with ACC.ahk.


I see. Does that explain, for example, why ACC_AccessibleObjectFromPoint supports optional x/y params and COM_AccessibleObjectFromPoint does not?

ACC_AccessibleObjectFromPoint(x = "", y = "", ByRef _idChild_ = "")
{
	VarSetCapacity(varChild,16,0)
	x<>""&&y<>"" ? pt:=x&0xFFFFFFFF|y<<32 : DllCall("GetCursorPos", "int64P", pt)
	DllCall("oleacc\AccessibleObjectFromPoint", "int64", pt, "UintP", pacc, "Uint", &varChild)
	_idChild_ := NumGet(varChild, 8 )
	Return	pacc
}

COM_AccessibleObjectFromPoint(x, y, ByRef _idChild_="")
{
	VarSetCapacity(varChild,16,0)
	If	DllCall("oleacc\AccessibleObjectFromPoint", "int", x, "int", y, "UintP", pacc, "Uint", &varChild)=0
	Return	pacc, _idChild_:=NumGet(varChild, 8 )
}

By the way, I realize this is now becoming more about COM than the Accessibility functions themselves per se, would you rather me move this discussion to that thread?

  • Guests
  • Last active:
  • Joined: --
Can you create a small example, when accessibility library detects keyboard focus and speaks detected focus object name and type, example exit button?

hughman
  • Members
  • 192 posts
  • Last active: Feb 14 2016 06:59 AM
  • Joined: 11 Feb 2007
I am very excited to get text from windows forms datagrid control via MSAA. But I want to know that if MSAA can maniplute the control without default actio, such as to select a row and double click it.

And I don't understand the structure of the variant array varChildren

johnmsch
  • Members
  • 23 posts
  • Last active: Sep 05 2019 08:03 PM
  • Joined: 15 Apr 2008

I use these include statements to avoid load errors:
#include e:\program files\AutoHotKey\Extras\Scripts\ACC.ahk
#include e:\program files\AutoHotKey\Extras\Scripts\COM.ahk


Just found this thread and am starting to play with this technique. Looks really promising! Is doing the include thing above the recommended way to link to the functions in those script files?

Thanks