StrokesPlus.net
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
liuchina  
#1 Posted : Thursday, January 21, 2021 1:40:09 AM(UTC)
liuchina

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 9/26/2018(UTC)
Posts: 73
China
Location: 北京

Thanks: 18 times
Was thanked: 1 time(s) in 1 post(s)
Hello Rob:
I need your help: break destroys the execution of for loop script.
Thank you.
Quote:
aa:for (i=1; i<=10;i++)
{
sp.Sleep(350);
sp.SendString(String(i));
sp.Sleep(50);
bb:for( i=1;i<=9999;i++ )
{ sp.Sleep(50);
var yyy=sp.GetCurrentMousePoint().Y;
if (yyy>=850 || yyy<=25)
{break bb;}
sp.Sleep(50);
}
sp.Sleep(50);
}

Edited by user Thursday, January 21, 2021 1:47:36 AM(UTC)  | Reason: Not specified

Rob  
#2 Posted : Thursday, January 21, 2021 1:41:47 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 1,349
United States
Location: Tampa, FL

Thanks: 28 times
Was thanked: 416 time(s) in 354 post(s)
You were using i in both loops, so the inner loop was increasing i beyond 10, causing the outer loop to exit once you broke out of the inner loop. Changed the inner loop to use j instead.
Code:
aa:
for (i=1; i<=10; i++)
{
    sp.Sleep(350);
    sp.SendString(String(i));
    sp.Sleep(50);
bb:
    for (j=1; j<=9999; j++)
    { 
        sp.Sleep(50);
        var yyy = sp.GetCurrentMousePoint().Y;
        if (yyy>=850 || yyy<=25)
        {
            break bb;
        }
        sp.Sleep(50);
    }
    sp.Sleep(50);
}

Edited by user Thursday, January 21, 2021 1:46:51 PM(UTC)  | Reason: Not specified

liuchina  
#3 Posted : Friday, January 22, 2021 12:26:01 AM(UTC)
liuchina

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 9/26/2018(UTC)
Posts: 73
China
Location: 北京

Thanks: 18 times
Was thanked: 1 time(s) in 1 post(s)

This problem has been solved perfectly. Thank you very much.
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.