I have a function that is retrieving data on a page. And I have a setTimer calling a function object referencing the function. It's all working but I'd like to simplify the function object if possible (I'm trying to simplify so I can diagnose/isolate some other issues in my script )
Code: Select all
url1 := "https://www.timeanddate.com/worldclock/usa/new-york-state"
ChromeInstance := new Chrome(profile, [url1], "")
PageInstance1 := ChromeInstance.GetPageByURL(url1)
FunctionGet(page,xpath)
{
%page%.Call("Page.bringToFront").WaitForLoad
myVar := xpath
tooltip, %myVar%
}
fn_nyc := Func("FunctionGet").bind(PageInstance1,PageInstance1.evaluate("document.evaluate('//*[@id=""ct""]', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.innerHTML").value)
SetTimer, %fn_nyc%, 2000
I'm sorry it's kind of a syntax hell...
Code: Select all
FunctionGet(page,xpath)
{
%page%.Call("Page.bringToFront").WaitForLoad
myVar := %page%.evaluate("document.evaluate('%xpath%', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.innerHTML").value
tooltip, %myVar%
}
fn_nyc := Func("FunctionGet").bind(PageInstance1,//*[@id=""ct""])
SetTimer, %fn_nyc%, 2000