Jump to content

why does this code fail?


c4mpi
 Share

Recommended Posts

#include <IE.au3>

$timer = TimerInit()


While 1
    Sleep(Random(1000,7000))
    $timed = TimerDiff($timer)
    If $timed > 3000 Then
        _IECreate("www.google.com")
        $timer = TimerInit()
    EndIf
WEnd

$timer2 = TimerInit()


While 2
    Sleep(Random(1000,2000))
    $timed2 = TimerDiff($timer2)
    If $timed2 > 5000 Then
        _IECreate("www.youtube.com.com")
        $timer2 = TimerInit()
    EndIf
WEnd

Why does this code fail? It doesnt open youtube.com every 5000 ms

thanks for answers

Edited by c4mpi
Link to comment
Share on other sites

  • Developers

Why would it? It never leaves the first While-Wend loop.

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

hehe, this is ofcourse a dumb question...

how can I make it?

Put both tests in the first loop?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...