@Frasier, just FYI: Word_Get.ahk
Regards,
burque505
Excel_Get
Re: Excel_Get
This method can automatically get the correct control:


Code: Select all
F1:: WordObj:=Word_Get("A")
Word_Get(WinTitle="ahk_class OpusApp")
{
return Office_Get(WinTitle)
}
Ppt_Get(WinTitle="ahk_class PP12FrameClass")
{
return Office_Get(WinTitle)
}
Excel_Get(WinTitle="ahk_class XLMAIN")
{
return Office_Get(WinTitle)
}
Office_Get(WinTitle="")
{
static h:=DllCall("LoadLibrary", "Str","oleacc", "Ptr")
WinGet, list, ControlListHwnd, % WinTitle ? WinTitle : "A"
For i,hWnd in StrSplit(list, "`n")
{
ControlGetPos, x, y, w, h,, ahk_id %hWnd%
if (y<10 or w<100 or h<100)
Continue
n:=Acc:=""
if DllCall("oleacc\AccessibleObjectFromWindow", "Ptr", hWnd
, "UInt", 0xFFFFFFF0, "Ptr", 0*(VarSetCapacity(IID,16)
+NumPut(0x0000000000020400,IID,"Int64")
+NumPut(0x46000000000000C0,IID,8,"Int64"))+&IID, "Ptr*", pacc)=0
Acc:=ComObject(9, pacc, 1)
Try n:=Acc.Application.Version
if (n)
return Acc.Application
}
MsgBox, 4096,, Error: Can't Get Object From ACC !
Exit
}
Return to “Scripts and Functions”
Who is online
Users browsing this forum: jacek678 and 16 guests