Facebook
From Sharp Pig, 1 Year ago, written in Autohotkey.
Embed
Download Paste or View Raw
Hits: 138
  1. #Include lib\UIA_Interface.ahk
  2. global UIA := UIA_Interface()
  3. ;learn more here https://github.com/Descolada/UIAutomation/wiki/04.-Elements
  4.  
  5. el := WinExist(" github.com/Descolada/UIAutomation ahk_exe AutoHotkey.exe")
  6.  
  7.  
  8. el := UI7(el)
  9. ; the handle can be re-used for various actions
  10.  
  11. Do_Click7(el)
  12.  
  13.  
  14. UI7(el){
  15.    WinActivate, ahk_id %el%
  16.    WinWaitActive, ahk_id %el%
  17.   el := UIA.ElementFromHandle(el)
  18.     return el
  19. }
  20.  
  21. Do_Click7(el){
  22.   loop, 10
  23.   {
  24.   try {
  25. el := el.FindFirstBy("ControlType=Document AND Name='Start capturing and press the F3 Key to add action.' AND AutomationId='41'",,2)
  26.        break
  27.    } catch e{
  28.       Sleep, 100
  29.      }
  30.   }
  31.  
  32. loop, 10
  33.   {
  34.   try {
  35. el.Click()  
  36.        break
  37.    } catch e{
  38.       Sleep, 100
  39.      }
  40.   }
  41.  
  42.   }