I am thinking of semi colon separated, or colon, or comma or something else.
Everything in a single line:
Code: Select all
loop
{
try (X1.Range("A1").Value := "=ROW()", error:=0)
catch error
sleep 10
if (!error)
break
}
Code: Select all
loop
{
try (X1.Range("A1").Value := "=ROW()", error:=0)
catch error
sleep 10
if (!error)
break
}
OK, yeah, that could be an option. But the question I wish to anwer now is can the above or any group of commands be written in one line, semicolon separated or whatever?Chunjee wrote: ↑22 Jan 2020, 11:17https://www.autohotkey.com/docs/commands/Try.htm
I think closest you could do is a function that does a try/catch inside.
Code: Select all
loop
{
try (X1.Range("A1").Value := "=ROW()", error:=0)
catch error
sleep 10
if (!error)
break
}
OK, so to have several commands colon separated like in VBAswagfag wrote: ↑22 Jan 2020, 13:18u can chain functions with a comma a(), b(), c()(not recommended)
u can chain some commands, legacy IfEqual(super not recommended)
u cant chain keywords
also i dont understand ur construct, ure misusing the concept of try/catch:the break should go inside the try-block. u shouldnt have to check catch's argument outside the catch-block.Code: Select all
loop { try (X1.Range("A1").Value := "=ROW()", error:=0) catch error sleep 10 if (!error) break }
Code: Select all
loop
{
try
{
X1.Range("A1").Value := "=ROW()"
break
}
catch
sleep 10
}
Code: Select all
loop
{
try (X1.Range("A1").Value := "=ROW()", error:=0)
catch error
sleep 10
if (!error)
break
}
Ok, thanks.
Code: Select all
try (X1.Range("A1").Value := "=ROW()", error:=0)
Users browsing this forum: filipemb, Google [Bot] and 398 guests