Code: Select all
oAcc := Acc_Get("Object", "1.30", 0, "ahk_id " hCtl)
Code: Select all
oAcc := Acc_Get("Object", "1.30", 0, "ahk_id " hCtl)
Code: Select all
;add an #Include line e.g.:
;#Include Acc.ahk
;#Include C:\MyDir\Acc.ahk
;or don't use #Include, but instead:
;copy Acc.ahk to an appropriate Lib folder:
;Functions - Definition & Usage | AutoHotkey
;https://www.autohotkey.com/docs/Functions.htm#lib
;%A_ScriptDir%\Lib\ ; Local library - requires [v1.0.90+].
;%A_MyDocuments%\AutoHotkey\Lib\ ; User library.
;directory-of-the-currently-running-AutoHotkey.exe\Lib\ ; Standard library.
q:: ;get text and Acc paths for GUI elements
WinGet, hWnd, ID, A
Clipboard := JEE_AccGetTextAll(hWnd, "`r`n")
MsgBox, % "done"
return
;paste the 'JEE_AccGetTextAll' function somewhere in the script
;(it can be above or below the code where it's used)
;available at these 2 links:
;GUIs via DllCall: get/set internal/external control text - AutoHotkey Community
;https://autohotkey.com/boards/viewtopic.php?f=6&t=40514
;Acc: get text from all window/control elements - AutoHotkey Community
;https://autohotkey.com/boards/viewtopic.php?f=6&t=40615
;JEE_AccGetTextAll(...)
;{
;...
;}
Code: Select all
Acc_Location(Acc, ChildId=0, byref Position="") { ; adapted from Sean's code
try Acc.accLocation(ComObj(0x4003,&x:=0), ComObj(0x4003,&y:=0), ComObj(0x4003,&w:=0), ComObj(0x4003,&h:=0), ChildId)
catch
return
Position := "x" NumGet(x,0,"int") " y" NumGet(y,0,"int") " w" NumGet(w,0,"int") " h" NumGet(h,0,"int")
return {x:NumGet(x,0,"int"), y:NumGet(y,0,"int"), w:NumGet(w,0,"int"), h:NumGet(h,0,"int")}
}
Code: Select all
;~Sean\Lib\Acc.ahk
Acc_Location(Acc, ChildId=0) { ; adapted from Sean's code
try Acc.accLocation(ComObj(0x4003,&x:=0), ComObj(0x4003,&y:=0), ComObj(0x4003,&w:=0), ComObj(0x4003,&h:=0), ChildId)
catch
return
return {x:NumGet(x,0,"int"), y:NumGet(y,0,"int"), w:NumGet(w,0,"int"), h:NumGet(h,0,"int")
, pos:"x" NumGet(x,0,"int")" y" NumGet(y,0,"int") " w" NumGet(w,0,"int") " h" NumGet(h,0,"int")}
}
;~jethrow\Acc.ahk
Acc_Location(Acc, ChildId=0) { ; adapted from Sean's code
try Acc.accLocation(ComObj(0x4003, & x := 0)
, ComObj(0x4003,&y:=0)
, ComObj(0x4003,&w:=0)
, ComObj(0x4003,&h:=0)
, ChildId)
catch
return
return { x:NumGet(x,0,"int")
, y:NumGet(y,0,"int")
, w:NumGet(w,0,"int")
, h:NumGet(h,0,"int")
, pos:"x" NumGet(x,0,"int")
. " y" NumGet(y,0,"int")
. " w" NumGet(w,0,"int")
. " h" NumGet(h,0,"int") }
}
Code: Select all
^t:: Msgbox % GetTextUnderMouse()
GetTextUnderMouse(){
Acc := Acc_ObjectFromPoint(child)
try value := Acc.accValue(child)
if Not value
try value := Acc.accName(child)
return value
}
return