Jump to content

daledale

Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by daledale

  1. Yeah, it's working now. Thank you. ps Strange that I didn't realize it right away, indeed, stringleft)))
  2. Nothing against it, the choice is up to the end users. I don't insist on my decision exclusively. Checked again, your option really doesn't work for me. Again, I have win7x64 (maybe you have win10,11 and that's the reason) and also maybe the reason is that I do NOT have an English language windows. 1 16:43:50 2 16:43:50 3 16:43:50 IP Protocol Configuration for Windows Ethernet 4 16:43:50 5 16:43:52 1 16:43:52 2 16:43:52 3 16:43:52 IP protocol configuration for Windows Ethernet 4 16:43:52 I'm sorry. I translate all my replies with a translator - I wrote earlier. Perhaps there are some difficulties in translation and you thought I insulted you. I apologize again.
  3. Thanks for the answer. I don't want to challenge your competence in any way. I think when you wrote that "the stream is not ready to transmit" - you mean that the command RUN was not completely finished. If so, I want to focus your attention to - what is printed last, when it hangs (see my reply above). This is not worked for me. I need gateway's ip from ipconfig. The above version of the program with ipconfig output does not do this, $line variable does not contain any ip addresses at all. ps I hope you saw the beginning of my reply on the previous page? There I provided three programs, one of which definitely works for me and overall my problem is solved. I just wanted to share a possible solution with the forum members. Now I don't have any problem related to this and my issue is, I repeat, solved.
  4. How I searched for the hang-up place. I changed the code as follows. ; freezes randomly #include <Date.au3> #include <Constants.au3> local $fDiff=0, $pid=0, $hTimer=0, $line="" While 1 ConsoleWrite('1 '&_NowTime()&@CRLF) $pid = Run("ipconfig", "", @SW_HIDE, 0x2) $line = "" ConsoleWrite('2 '&_NowTime()&@CRLF) $hTimer = TimerInit() While 1 $fDiff = TimerDiff($hTimer) $line &= StdoutRead($pid) If @error or $fDiff>50 Then ExitLoop Wend ConsoleWrite('3 '&_NowTime()&@CRLF) if StringInStr($line,'0.1'&@CRLF)>1 then TraySetIcon("icon1.ico") if StringInStr($line,'0.2'&@CRLF)>1 then TraySetIcon("icon2.ico") ConsoleWrite('4 '&_NowTime()&@CRLF) sleep(20000) ConsoleWrite('5 '&_NowTime()&@CRLF) WEnd In general, in all cases of freezing, the last thing printed was, for example: 2 07:08:09 Something like that.
  5. That's the thing, you suggest inserting the _RunWaitEx() operator instead of Run() into the so-called outer loop, because initially for me, as well as in the example above, Run() is in the outer loop. But this does not solve the problem of hanging. I repeat, in my program the Sleep() operator was initially in the outer loop already. I repeat, the problem is solved if and only if the sleep delay is located in the inner loop, near StdoutRead() Ok, to make it clearer or, as we say: "Instead of thousand words" - two versions of my code. Explanation - I have two gateways in the local network and I want to see online which gateway is currently enabled. Below are two versions of the program. The 1st code - hangs after a random time, the 2nd - does not. ; freezes randomly local $fDiff=0, $pid=0, $hTimer=0, $line="" While 1 $pid = Run("ipconfig", "", @SW_HIDE, 0x2) $line = "" $hTimer = TimerInit() While 1 $fDiff = TimerDiff($hTimer) $line &= StdoutRead($pid) If @error or $fDiff>50 Then ExitLoop Wend if StringInStr($line,'0.1'&@CRLF)>1 then TraySetIcon("icon1.ico") if StringInStr($line,'0.2'&@CRLF)>1 then TraySetIcon("icon2.ico") sleep(20000) WEnd ; works fine local $fDiff=0, $pid=0, $hTimer=0, $line="" While 1 $pid = Run("ipconfig", "", @SW_HIDE, 0x2) $line = "" $hTimer = TimerInit() While 1 $fDiff = TimerDiff($hTimer) sleep(20) $line &= StdoutRead($pid) If @error or $fDiff>50 Then ExitLoop Wend if StringInStr($line,'0.1'&@CRLF)>1 then TraySetIcon("icon1.ico") if StringInStr($line,'0.2'&@CRLF)>1 then TraySetIcon("icon2.ico") sleep(20000) WEnd The parameter with the timer, as an additional condition for exiting the cycle = 50 - was selected experimentally. In principle, it was possible to do without this condition, but just in case, this was also done at the stage of searching for a hang and remained so. Theoretically, you can do without the timer, and then the program will take on an even more compact form. ; maybe works fine local $pid=0, $line="" While 1 $pid = Run("ipconfig", "", @SW_HIDE, 0x2) $line = "" While 1 sleep(20) $line &= StdoutRead($pid) If @error Then ExitLoop Wend if StringInStr($line,'0.1'&@CRLF)>1 then TraySetIcon("icon1.ico") if StringInStr($line,'0.2'&@CRLF)>1 then TraySetIcon("icon2.ico") sleep(20000) WEnd
  6. Sorry for my English, translated by Google. Search for the error of Autoit freezing with the operator "stdoutread"brought me to this topic. What can I say, but first about my configuration: Autoit 3.3.14 Win7x64 CPU Core-i7 CPU, 32Gb RAM Approximately the following program code froze for me. I became interested in the reasons. After each of the key operators, I put the so-called marks in the form of console and found that the freezing occurs quite quickly from 10 minutes to 1 hour in the inner loop (where the operator is stdoutread). In the example above, the inner loop is the Do/Until operators. In general, I will not keep you in suspense - I am not 100% sure yet, but my problem was solved* by inserting the Sleep(20) delay into this inner loop. Yes, I will immediately make a reservation - the Sleep delay in the external operator (in the example, it is While/Wend) was initially set for me, I needed it for my purposes and the delay was 20 seconds. Sleep(20000), but it did not help to get rid of the freezes. * - At least I assume and hope so, because more than 2 hours have passed and in my case there are 437 iterations and no freezes. By the way, I draw attention to this quote: "The important part here is the Sleep (200) just after the Run('tasklist.exe") line " and I repeat the operator sleep, which is mentioned in the quote, was initially in the outer loop and this did not help to solve the problem. The problem was solved precisely by the fact that the operator sleep was located in the inner loop (Between Do/Until in Example above)
×
×
  • Create New...