Listlines at top of the script shows it's doing everything it's supposed too. It iopen IE url but doesn't click. If I however change "wb" to "xx" where xx is anything else than wb it works. Next time if I run it (and this happens even if i restart the pc) it stops working, then I have to change xx to a new xx (xx is whatever letters I write, randomly).
Here's the code:
Code: Select all
#persistent
#Singleinstance, force
#NoEnv
Gui, LunchTime:new
Gui, LunchTime:color, green
Gui, LunchTime:-caption
Gui, LunchTime:add, edit, w50 limit2 number vLunchTid
Gui, LunchTime:add, button, Hidden default, submit
Gui, LunchTime:show, autosize, Lunch
return
LunchTimeButtonSubmit:
gui, LunchTime:submit
wb := ComObjCreate("InternetExplorer.Application")
wb.Visible := false
wb.Navigate("https://checkin.com/")
IELoad(wb)
wb.document.GetElementByID("out").click()
wb.quit
settimer, lunch_time, % 1000 * 60 * lunchtid ; Minutes
Gui, LunchTime:destroy
return
LunchTimeGuiEscape:
LunchTimeGuiClose:
Gui, LunchTime:destroy
return
lunch_time:
wb := ComObjCreate("InternetExplorer.Application")
wb.Visible := false
wb.Navigate("https://checkin.com")
IELoad(wb)
wb.document.GetElementByID("inn").click()
wb.quit
settimer, lunch_time, off
return
IELoad(wb)
{
global
If !wb ;If wb is not a valid pointer then quit
Return False
Loop ;Otherwise sleep for .1 seconds untill the page starts loading
Sleep,100
Until (wb.busy)
Loop ;Once it starts loading wait until completes
Sleep,100
Until (!wb.busy)
Loop ;optional check to wait for the page to completely load
Sleep,100
Until (wb.Document.Readystate = "Complete")
Return True
}