Page 1 of 1

Anyone can help me correct this?

Posted: 29 Jan 2019, 16:03
by RaisetheBass

Code: Select all

#NoEnv
Loop
{
IE.Visible := True
WinActivate, ahk_class IEFrame
WinWaitActive, ahk_class IEFrame
WinGetTitle, WinTitle, ahk_class IEFrame
wb:=pwb_Get()
loaded := false
While !loaded
    try
    {
        if (wb.document.GetElementByID("wait") != "")
            loaded := true
    Sleep 100
if (wb.document.GetElementsByTagName("dv")[20].innertext) = "Online"
	goto Copy1
	else if (wb.document.GetElementsByTagName("dv")[25].innertext) = "Online"
	goto Copy2
	else if (wb.document.GetElementsByTagName("dv")[30].innertext) = "Online"
	goto Copy3
	else if (wb.document.GetElementsByTagName("dv")[35].innertext) = "Online"
	goto Copy4
	else if (wb.document.GetElementsByTagName("dv")[40].innertext) = "Online"
	goto Copy5
	else if (wb.document.GetElementsByTagName("dv")[70].innertext) = "Offline"
	goto Copy6 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< until here and skip to next d
	else if (wb.document.GetElementsByTagName("dv")[75].innertext) = "Offline"
	goto Copy7
	else if (wb.document.GetElementsByTagName("dv")[80].innertext) = "Offline"
	goto Copy8
	else if (wb.document.GetElementsByTagName("dv")[85].innertext) = "Offline"
	goto Copy9
	else if (wb.document.GetElementsByTagName("dv")[90].innertext) = "Offline"
	goto Copy10
	else if (wb.document.GetElementsByTagName("dv")[123].innertext) = "Online"
	goto Copy11
	else if (wb.document.GetElementsByTagName("dv")[128].innertext) = "Online"
	goto Copy12
	else if (wb.document.GetElementsByTagName("dv")[132].innertext) = "Online"
	goto Copy13
	else if (wb.document.GetElementsByTagName("dv")[137].innertext) = "Online"
	goto Copy14
	else if (wb.document.GetElementsByTagName("dv")[142].innertext) = "Online"
	goto Copy15
	else
	goto Next
}
}
why my code run until copy6 then skip to next already?
can some help me to correct?
thank you very much... :bravo: :superhappy:

Re: Anyone can help me correct this?

Posted: 29 Jan 2019, 16:32
by safetycar
On Copy6 there must be another goto saying to go there.
It's usually recommended to try to avoid goto, for example using GoSub instead.
goto never returns to it's caller, GoSub picks up where it left after finishing.