Anyone can help me correct this?

Get help with using AutoHotkey and its commands and hotkeys
RaisetheBass
Posts: 16
Joined: 08 Jul 2018, 06:17

Anyone can help me correct this?

29 Jan 2019, 16:03

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:
safetycar
Posts: 125
Joined: 12 Aug 2017, 04:27

Re: Anyone can help me correct this?

29 Jan 2019, 16:32

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.

Return to “Ask For Help”

Who is online

Users browsing this forum: Google [Bot], scriptor2016, songdg and 38 guests