if statement problem..please help...

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
RaisetheBass
Posts: 16
Joined: 08 Jul 2018, 06:17

if statement problem..please help...

28 Jan 2019, 22:53

can someone help me with this? why my code only run until Copy 6...

Code: Select all

loaded := false
While !loaded
    try
    {
        if (wb.document.GetElementByID("wait") != "")
            loaded := true
    Sleep 100
if (wb.document.GetElementsByTagName("td")[0].innertext) = "Online"
	goto Copy1
	else if (wb.document.GetElementsByTagName("td")[1].innertext) = "Online"
	goto Copy2
	else if (wb.document.GetElementsByTagName("td")[2.innertext) = "Online"
	goto Copy3
	else if (wb.document.GetElementsByTagName("td")[3].innertext) = "Online"
	goto Copy4
	else if (wb.document.GetElementsByTagName("td")[4].innertext) = "Online"
	goto Copy5
	else if (wb.document.GetElementsByTagName("td")[5].innertext) = "Online"
	goto Copy6 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
	else if (wb.document.GetElementsByTagName("td")[6].innertext) = "Online"
	goto Copy7
	else if (wb.document.GetElementsByTagName("td")[7].innertext) = "Online"
	goto Copy8
	else if (wb.document.GetElementsByTagName("td")[8].innertext) = "Online"
	goto Copy9
	else if (wb.document.GetElementsByTagName("td")[9].innertext) = "Online"
	goto Copy10
	else if (wb.document.GetElementsByTagName("td")[10].innertext) = "Online"
	goto Copy11
	else if (wb.document.GetElementsByTagName("td")[11].innertext) = "Online"
	goto Copy12
	else if (wb.document.GetElementsByTagName("td")[12].innertext) = "Online"
	goto Copy13
	else if (wb.document.GetElementsByTagName("td")[13].innertext) = "Online"
	goto Copy14
	else if (wb.document.GetElementsByTagName("td")[14].innertext) = "Online"
	goto Copy15
	else
	goto Next
Image
hd0202
Posts: 183
Joined: 04 Oct 2013, 03:07
Location: Germany near Cologne

Re: if statement problem..please help...

29 Jan 2019, 02:16

shure there are more than 6 elements ?
btw, I suggest a much shorter version:

Code: Select all

loop, 15
{
    if (wb.document.GetElementsByTagName("td")[a_index - 1].innertext) = "Online"
        goto Copy%a_index%
}
goto Next
Hubert

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Anput, Descolada, Google [Bot], Nerafius and 214 guests