Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Auto-enable accessible objects in Chrome
#1
The Chrome web browser supports accessible objects in web pages, but this is disabled by default. QM tries to auto-enable it on demand, but with current Chrome version it fails.

You can explicitly enable Chrome accessible objects: run chrome.exe with command line --force-renderer-accessibility
Code:
Copy      Help
run "chrome.exe" "--force-renderer-accessibility"

But there is a better way.
The simplest way - create this function and assign this trigger (to read how, click the small ? links below). The trigger enables Chrome accessibility. The function itself is empty and never runs.
Function enable_chrome_acc_t
Trigger $a 2 1 "" "" "" "" "" "" 8     Help - how to add the trigger to the macro
QM must be running when starting Chrome process. If QM is not running all the time, instead use this:
Make exe from this function, and let it run at Windows startup. For example, add a shortcut to it to the Startup folder, which is in the Start menu. Let the exe run all the time. If you want to end its process, use Task Manager.
Function enable_chrome_acc
Code:
Copy      Help
int hh=SetWinEventHook(EVENT_SYSTEM_ALERT EVENT_SYSTEM_ALERT 0 &sub.Hook_SetWinEventHook 0 0 WINEVENT_OUTOFCONTEXT)
;mes 1
opt waitmsg 1; wait -1
UnhookWinEvent hh


#sub Hook_SetWinEventHook
function hHook event hwnd idObject idChild dwEventThread dwmsEventTime

if idObject=1
,IAccessible a; VARIANT v
,AccessibleObjectFromEvent(hwnd idObject idChild &a &v)

;BEGIN PROJECT
;main_function  enable_chrome_acc
;exe_file  $my qm$\enable_chrome_acc.exe
;icon  <default>
;manifest  $qm$\default.exe.manifest
;flags  6
;guid  {35DE25AC-7AD6-4AD8-805A-65B7532D84BC}
;END PROJECT
#2
Hello Gintaras,

Is there a similar function to enable_chrome_acc_t that can be applied to Microsoft Edge browser?
I came across a problem where objects on Microsoft Edge are inaccessible, and only become accessible once using the ''find accessible objects'' dialog from QM
#3
Maybe you use an old QM version. Current version auto-enables Edge objects.

Tested with this code:
Code:
Copy      Help
int w=wait(3 WV win("- Microsoft​ Edge" "Chrome_WidgetWin_1"))
Acc a.Find(w "LINK" "QM3 preview" "" 0x3001 3)
out a.Name

Also try this new program. It finds Chrome and Edge objects ~30 times faster. Auto-enables objects possibly better than QM.
https://www.quickmacros.com/au/help/
#4
Thank you for your quick response!

I work at a place where upgrading to the latest QM would likely not be possible.
They are running QM version 2.4.2.2
Is there any way to still get those accessible objects from Edge? What code does the "Accessible objects actions" dialog in QM run in the background to make this possible?

Thanks in advance
#5
The dialog just uses API to get "object from mouse position". Then Edge enables objects. But Edge does not enable objects when something uses API for finding objects.

Function EnableChromeAcc
Code:
Copy      Help
function [w]

;Enables accessible objects in Chrome or Edge.

;w - browser window handle. If 0, this function tries to find Chrome or Edge.


if !w
,w=win("Google Chrome" "Chrome_WidgetWin_1")
,if !w
,,w=win("Microsoft​ Edge" "Chrome_WidgetWin_1")
,,if(!w) end "Browser window not found"

int c=child("" "Chrome_RenderWidgetHostHWND" w)
if(!c) end "Browser child window not found"

SendMessage(c WM_GETOBJECT 0 1)
Acc a.FromWindow(c OBJID_CLIENT)
rep 100
,int n=a.ChildCount
,if(n>0) break
,a.Name
,a.a.DefaultAction(0)
,0.02
#6
That works! Thank you so much!


Forum Jump:


Users browsing this thread: 1 Guest(s)