Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Accessible object trigger to waitfor routine
#1
This is the keyboard trigger to monitor clicking on one of the two PUSHBUTTONs (Save/Cancel) on Google Chrome's print (Ctrl-P)screen. I am afraid that it is not possible to locate these buttons using Acc techniques. The trigger works properly. My question is whether and how I could convert this trigger to a waitfor routine. Any advice will be appreciated.

Function tempf01
Trigger $a 133 -4 "" "Chrome_RenderWidgetHostHWND" "" "Chrome Legacy Window" "Chrome_WidgetWin_1" "" 43     Help - how to add the trigger to the macro
Code:
Copy      Help
;\
function hwnd idObject idChild
Acc a.FromEvent(hwnd idObject idChild)
_s=a.Name

mes _s "Clicked"
#2
Macro Macro2763
Code:
Copy      Help
__Handle ev=CreateEvent(0 0 0 0)
Acc a
int hh=SetWinEventHook(EVENT_OBJECT_FOCUS EVENT_OBJECT_FOCUS 0 &sub.Hook_SetWinEventHook 0 0 WINEVENT_OUTOFCONTEXT)
opt waitmsg 1
wait 0 H ev
UnhookWinEvent hh

_s=a.Name
mes _s "Clicked"


#sub Hook_SetWinEventHook v
function hHook event hwnd idObject idChild dwEventThread dwmsEventTime

if(idObject!=OBJID_CLIENT) ret
;outw hwnd
if(!WinTest(hwnd "Chrome_RenderWidgetHostHWND")) ret
a.FromEvent(hwnd idObject idChild)
if(a.Role!=ROLE_SYSTEM_PUSHBUTTON) ret
SetEvent ev

err+
#3
Thank you very much! I am once more obliged. Best regards.


Forum Jump:


Users browsing this thread: 1 Guest(s)