Innovative Posted February 29, 2008 Share Posted February 29, 2008 Here is one of the func in my script i click on the button but it did not displayed the msgbox . No matter how i tries. expandcollapse popupFunc _detect2000() Local $xx = 0,$bIN = 0,$pbIN = 0, $bOUT = 0, $pbOUT = 0, $ts = 0, $pts = 0 Local $frq = 0, $rateIN = 0, $rateOUT = 0, $coFAX = 0, $step = 1, $ostep = 1 While $xx = 0 Sleep(1000) ; 250 matches Task Manager $colItems = $objWMIService.ExecQuery("SELECT BytesReceivedPerSec, BytesSentPerSec, Timestamp_PerfTime," _ & "Frequency_Perftime, CurrentBandwidth FROM Win32_PerfRawData_Tcpip_NetworkInterface", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) Then For $objItem In $colItems If $frq = 0 Then ; get first frequency counter then repeat $frq = $objItem.Frequency_PerfTime ExitLoop EndIf $bIN = $objItem.BytesReceivedPersec ; current bps value, every 1000ms $bOUT = $objItem.BytesSentPersec $frq = $objItem.Frequency_PerfTime $ts = $objItem.Timestamp_PerfTime $nMAX = $objItem.CurrentBandwidth;/1000000 ; connection speed of NIC If $nMAX = 1000000000 Then $maxin = "1.7" $maxout = "1.3" $nMAX = "1 Gb" $coFAX = 125000 ElseIf $nMAX = 100000000 Then $maxin = "30000" $maxout = "20000" $nMAX = "100 Mb" $coFAX = 12500 ElseIf $nMAX = 10000000 Then $maxin = "25000" $maxout = "15000" $nMAX = "10 Mb" $coFAX = 1250 EndIf ; 1 megabit (Mb) = 1,000,000 bits or 125,000 bytes or 125 kilobytes $rateIN = ($bIN - $pbIN) / (($ts - $pts) / $frq) $rateOUT = ($bOUT - $pbOUT) / (($ts - $pts) / $frq) If $rateIN > $maxin Then ; must avove $createNSgui = GUICreate("-", 400, 440, 306, 184) $s_NSnoti = GUICtrlCreateLabel ("-", 5, 5 , 400, 100) $2_button = GuiCtrlCreateButton("test", 150, 150) GuiCtrlSetFont($s_NSnoti, 10, 400, "","Comic Sans MS") GUISetState(@sw_show) While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENt_CLOSE MsgBox(0, "", "gui event close") Case $2_button MsgBox(0, "", "2_button") EndSwitch WEnd EndIf If $rateOUT > $maxout Then ConsoleWrite("OUT MAXED" & @Crlf) Endif $pbIN = $bIN ; set previous IN $pbOUT = $bOUT ; set previous OUT $pts = $ts ; set previous Timestamp $step += 1 If $step = 199 Then $step = 1 EndIf ExitLoop Next EndIf If Not $isMON Then $xx = 1 EndIf WEnd EndFunc Link to comment Share on other sites More sharing options...
PsaltyDS Posted February 29, 2008 Share Posted February 29, 2008 Your GUI is created over and over again in nested For/Next loops. Are you sure the GUI you are pulling GuiGetMsg() from (and the $2_button) is the same one you are testing for? How do you break out of the loop? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Innovative Posted March 1, 2008 Author Share Posted March 1, 2008 Dont really know what you're talking about .. lol .. Can you please help to correct me ? Link to comment Share on other sites More sharing options...
PsaltyDS Posted March 1, 2008 Share Posted March 1, 2008 Dont really know what you're talking about .. lol .. Can you please help to correct me ? This is what you posted, stripped down to just the loops and GUI to show the nesting:Func _detect2000() While $xx = 0 If IsObj($colItems) Then For $objItem In $colItems If $rateIN > $maxin Then $createNSgui = GUICreate("-", 400, 440, 306, 184) $s_NSnoti = GUICtrlCreateLabel("-", 5, 5, 400, 100) $2_button = GUICtrlCreateButton("test", 150, 150) GUICtrlSetFont($s_NSnoti, 10, 400, "", "Comic Sans MS") GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENt_CLOSE MsgBox(0, "", "gui event close") Case $2_button MsgBox(0, "", "2_button") EndSwitch WEnd EndIf ExitLoop Next EndIf WEnd EndFunc ;==>_detect2000oÝ÷ Ù8^èzÓ,Z(¦+0Øb¥¡W¿XIÝ)¶ÉÞ²×v¢¿Í{e¢p'!ÉÞ²×v§¢Ø^hbïÖwe¢S+¢é]Âänëmç(^Æ+r©²h¬µ©²j+zX¤z¢·±jjeyhZµºÞjK2¢ê.¶íá®g2È%¢lwÓ~PÔÂ,ä¢yr¦lhË ZÛaz{azZ(¥Ê'¶)îzÄáxeo(±é_Âä±ø§y»«'¡ìbµ«¢+Ø¥¹±Õ±ÐíÕ¥ ½¹ÍѹÑ̹ÔÌÐì((ÀÌØíÉÑ9MÕ¤ôU% ÉÑ ÅÕ½Ðì´ÅÕ½Ðì°ÐÀÀ°ÐÐÀ°ÌÀØ°ÄàФ(ÀÌØíÍ}9M¹½Ñ¤ôU% Ñɱ ÉÑ1° ÅÕ½Ðì´ÅÕ½Ðì°Ô°Ô°ÐÀÀ°ÄÀÀ¤(ÀÌØìÉ}ÕÑѽ¸ôU% Ñɱ ÉÑ ÕÑѽ¸ ÅÕ½ÐíÑÍÐÅÕ½Ðì°ÄÔÀ°ÄÔÀ¤)U% ÑɱMѽ¹Ð ÀÌØíÍ}9M¹½Ñ¤°ÄÀ°ÐÀÀ°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½Ðí ½µ¥M¹Ì5LÅÕ½Ðì¤)U%MÑMÑÑ¡M]}M!=¤)]¡¥±Ä($ÀÌØíµÍôU%Ñ5Í ¤(%MÝ¥Ñ ÀÌØíµÍ($% ÍÀÌØíU%}Y9Ñ} 1=M($$%5Í ½à À°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½Ðíդٹб½ÍÅÕ½Ðì¤($% ÍÀÌØìÉ}ÕÑѽ¸($$%5Í ½à À°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½ÐìÉ}ÕÑѽ¸ÅÕ½Ðì¤(%¹MÝ¥Ñ )]¹ Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law 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