Jump to content

How many time repeated a cycle?


 Share

Recommended Posts

ConsoleWrite($n_n & @CRLF)

BTW, your line $n_n++ is written wrong.

$n_n += 1

 

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

12 minutes ago, reida said:

Thanks and how to finish script work if $n_n it is more 10?

For $n_n = 0 To 10 - 1; 0..9 is ten
    $ToAs = FileReadLine($hFile)
    If @error Then ExitLoop
    _INet()
    ;$n_n++; removed it's now the loop iterator.
    Local $Random = Random(20000, 50000, 1)
    Sleep($Random)
Next

I know 0 To 10 - 1 might look goofy.  You are free to make it 1 To 10.  Or 0 To 9.

Maybe 0 To 10 if you want it to stop at 11.  Or 1 To 11.

Edited by Xandy
Link to comment
Share on other sites

12 minutes ago, Xandy said:

 

 

6 minutes ago, Xandy said:

ow it's a string Idk.  Your code looks fine to me.

Thanks and if I want to make after 10 repetitions of a cycle a pause 3 hours, then to continue 10 more - 12 cycles still a pause 3 hours.

Link to comment
Share on other sites

There are different ways you can do it.

You can halt your entire script using a:

$sleep_duration = 1000 * 60 * 60 * 3
Sleep($sleep_duration)

Or use a timer and an infinite loop.  This will not lock the script for the $sleep_duration. 

Note: You can remove the Sleep(20); Eat cycles if your main loop has a GUIGetMsg()

$sleep_duration = 1000 * 60 * 60 * 3
$sleep_timer = TimerInit()
Do
    If TimerDiff($sleep_timer) >= $sleep_duration Then
        For $n_n = 0 To 10 - 1; 0..9 is ten
            $ToAs = FileReadLine($hFile)
            If @error Then ExitLoop
            _INet()
            ;$n_n++; removed it's now the loop iterator.
            Local $Random = Random(20000, 50000, 1)
            Sleep($Random)
        Next
        $sleep_timer = TimerInit()
    EndIf
    Sleep(20); Eat cycles to prevent overheat
Until 0

Note: There is no way to stop this built into the script.

Edited by Xandy
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

×
×
  • Create New...