reida Posted August 6, 2018 Share Posted August 6, 2018 (edited) Hello. How to show in the console of the indication of the counter $n_n? While 1 $ToAs = FileReadLine($hFile) If @error Then ExitLoop _INet() $n_n++ Local $Random = Random(20000, 50000, 1) Sleep($Random) WEnd Edited August 6, 2018 by reida Link to comment Share on other sites More sharing options...
BrewManNH Posted August 6, 2018 Share Posted August 6, 2018 ConsoleWrite($n_n & @CRLF) BTW, your line $n_n++ is written wrong. $n_n += 1 reida 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 GudeHow 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 More sharing options...
reida Posted August 6, 2018 Author Share Posted August 6, 2018 (edited) 9 minutes ago, BrewManNH said: Thanks and how to finish script work if $n_n it is more 10? If $n_n>10 Then Exit does not finish work Edited August 6, 2018 by reida Link to comment Share on other sites More sharing options...
Xandy Posted August 6, 2018 Share Posted August 6, 2018 (edited) 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 August 6, 2018 by Xandy reida 1 Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
Xandy Posted August 6, 2018 Share Posted August 6, 2018 (edited) If: [ If $n_n>10 Then Exit ] Doesn't work try: If Int($n_n) > 10 Then Exit May be somehow it's a string Idk. Your code looks fine to me. Edited August 6, 2018 by Xandy reida 1 Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
reida Posted August 6, 2018 Author Share Posted August 6, 2018 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 More sharing options...
Xandy Posted August 7, 2018 Share Posted August 7, 2018 (edited) 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 August 7, 2018 by Xandy Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now