Code: Select all
#If test()
f10::
#if
#If test1()
f11::
#if
test()
{
ComObjCreate("InternetExplorer.Application")
}
test1()
{
ComObjCreate("WinHTTP.WinHTTPRequest.5.1")
}
Code: Select all
#If test()
f10::
#if
#If test1()
f11::
#if
test()
{
ComObjCreate("InternetExplorer.Application")
}
test1()
{
ComObjCreate("WinHTTP.WinHTTPRequest.5.1")
}
You are creating a new instance of IE every time the expression is evaluated. How long does it take for IE to load-up when you launch it manually? I don't think it can keep up. Try re-thinking your approach to limit the number of times ComObjCreate is called, and be sure to close the objects you create when finished.https://autohotkey.com/docs/commands/_If.htm#General_Remarks wrote:Note: Scripts should not assume that the expression is only evaluated when the key is pressed (see below).
The expression may also be evaluated whenever the program needs to know whether the hotkey is active. For example, the #If expression for a custom combination like a & b:: might be evaluated when the prefix key (a in this example) is pressed, to determine whether it should act as a custom modifier key.
I will get error after first run.Try re-thinking your approach to limit the number of times ComObjCreate is called
Ok, one more example:How long does it take for IE to load-up when you launch it manually? I don't think it can keep up
Code: Select all
;ComObjError(false)
#If test()
f10::
#if
test()
{
a := a_tickcount
ComObjGet("winmgmts:")
msgbox % a_tickcount - a
}
Code: Select all
#If !test()
f10:: return
#If
return
f11::test()
return
test()
{
tooltip % Acc_test(child).accName(child)
}
Acc_test(ByRef _idChild_ = "", x = "", y = "")
{
Static h
If Not h
h:=DllCall("LoadLibrary","Str","oleacc","Ptr")
If DllCall("oleacc\AccessibleObjectFromPoint", "Int64", x==""||y==""?0*DllCall("GetCursorPos","Int64*",pt)+pt:x&0xFFFFFFFF|y<<32, "Ptr*", pacc, "Ptr", VarSetCapacity(varChild,8+2*A_PtrSize,0)*0+&varChild)=0
Return ComObjEnwrap(9,pacc,1), _idChild_:=NumGet(varChild,8,"UInt")
}
Users browsing this forum: eagerahk, lavender, pizzatime, regnonmolina and 96 guests