Jump to content

Recommended Posts

Posted

For $k = 1 to 18
    ;MsgBox(0, "#", $k, 1)
  Sleep (30001);
  DoOneThing()
                 Next
    Sleep (30001)
    DoOtherThing()

For some reason, the for loop just doesn't seem to execute the DoOneThing() call, and the overall execution time is about 18 * 30 seconds. The DoOneThing() function just iterates through the links on a page until it finds certain text. What ends up happening is it sleeps, then it calls DoOtherThing().

I've been trying to play with this code for awhile, and it acts very oddly. I've tried switching the 30001 line to 11000, with no results. It works when I uncomment out the MsgBox line, which I can do, but I just want to know why it's acting so bizarrely. It doesn't seem like there's anything wrong with my code, so does anyone have any suggestions?

Posted

The code below works as expected for me. I just defined your two functions to provide a splash screen to show iterations and a message box when done. The only way you could get out of the For-Next loop in your code is if $k was a global variable and you changed it in the DoOneThing() function.

This works for me:

For $k = 1 to 18
  Sleep (3000)
  DoOneThing()
Next
Sleep (3000)
DoOtherThing()

Func DoOneThing()
  SplashTextOn("Iteration", "On iteration #" & $k)
  Sleep(1000)
  SplashOff()
EndFunc

Func DoOtherThing()
  MsgBox(0, "Test complete", "Test is now completed.  Now exiting.")
EndFunc

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Posted

Yeah, it's not a global variable--that was the first thing I checked for. I really have no idea why there seems to be no consistent behavior. I ran it last night as a test, and it was successful the first time, failed the second, and succeeded the next three. It's possible to sleep for 30001 milliseconds, right?

Posted

It's possible to sleep for 30001 milliseconds, right?

Yup, and just for fun I changed my sleep in my posted code to 30001 ms to confirm this. I suppose it's possable that you have bad RAM or something that's causing computations to fail, but you'd expect more wide-spread problems if this were the case. For the record, I'm using the June 22nd release of 3.0.102.

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Posted

I'm using v3.0.101 on the computers. I'm pretty sure it's not bad RAM, not only because there'd be more symptoms, but it also fails on three different machines.

Let me ask this question, then--is there any reason why a messagebox would fix a problem? At all?

Oh, and to be more specific, DoOneThing is just clicking a link on a web page by tabbing through every link until it's found.

Actually, another question. Is there any way to log every command that's issued without actually writing the log lines after every line? Like, "these are the following commands that have been issued"?

Posted

Perhaps you should post the complete listing... since from your code, it shoudl work fine.

Any of my own codes posted on the forum are free for use by others without any restriction of any kind. (WTFPL)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...