MariusN Posted March 9, 2010 Share Posted March 9, 2010 I have a function in the tray-section that gets executed every 2 secs...I noticed that the timer wont activate unless i move my mouse over the tray-icon...Is there some setting to overcome this? thx guys... Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 9, 2010 Moderators Share Posted March 9, 2010 MariusN,You should know by now what we are going to say......"Show some code!" You see, my crystal ball is at the repairers for a few days. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Fulano Posted March 9, 2010 Share Posted March 9, 2010 MariusN,You should know by now what we are going to say......"Show some code!" You see, my crystal ball is at the repairers for a few days. M23Don't worry, you can borrow mine ......Uhhhh, where'd I put that thing? #fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 9, 2010 Moderators Share Posted March 9, 2010 Fulano, Thanks for the offer, but on this side of the Atlantic I need a 240V model. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
MariusN Posted March 9, 2010 Author Share Posted March 9, 2010 (edited) ...the "code" expandcollapse popup_tray() Opt('MustDeclareVars', 1) Opt("TrayMenuMode", 3) Func _tray() Local $i_timer2, $test, $readtest, $MSG, $i_pid2, $s_stdout, $receive, $send, $var1, $rnd1, $rnd2, $rnd3, $rnd4, $var2 Local $open1, $read8, $open4, $write2, $open5, $read9, $open2, $read2, $open3, $open1, $open6, $open7, $read10,$i_timer,$fileLog, $fileLog2,$view,$exititem Local $write1, $read1, $total1, $read4, $read3, $i_timer Local $ip_sec = 1 $fileLog = (@ScriptDir & "\nrd3.txt") $fileLog2 = (@ScriptDir & "\total.log") $rnd3 = $rnd1 + $rnd2 $view = TrayCreateItem("View Live Feed") $exititem = TrayCreateItem("Exit") Opt('MustDeclareVars', 1) Opt("TrayMenuMode", 3) TraySetState() While 1 $MSG = TrayGetMsg() Select Case $MSG = 0 ContinueLoop Case $MSG = $view ;_Start() Case $MSG = $exititem Exit EndSelect If TimerDiff($i_timer2) / 1000 >= 2 Then MsgBox(0, "", "timerdiff") $i_pid2 = Run(@ComSpec & " /c netstat -e", @SystemDir, @SW_HIDE, 6) While 1 $s_stdout &= StdoutRead($i_pid2) If @error Then ExitLoop EndIf WEnd If $s_stdout Then $receive = StringMid($s_stdout, 100, 17) $send = StringMid($s_stdout, 115, 17) $var1 = $receive / 1048576 $rnd1 = Round($var1, 3) $var2 = $send / 1048576 $rnd2 = Round($var2, 3) $rnd3 = $rnd1 + $rnd2 ;============================================================================================== $open5 = FileOpen($fileLog2, 0) $read3 = FileReadLine($open5, 1) FileClose($open5) If $read1 = $rnd3 Then Else $open1 = FileOpen($fileLog, 0) $read1 = FileReadLine($open1, 1) ; Total1 FileClose($open1) $open2 = FileOpen($fileLog, 2) $write1 = FileWriteLine($open2, $rnd3) ;Total2 FileClose($open2) $total1 = $rnd3 $open3 = FileOpen($fileLog2, 0) $read2 = FileReadLine($open3, 1) FileClose($open3) $open4 = FileOpen($fileLog2, 2) FileWriteLine($open4, $read2 + $rnd3 - $read1) FileClose($open4) $open6 = FileOpen($fileLog2, 0) $read4 = FileReadLine($open6, 1) FileClose($open6) EndIf $s_stdout = "" $i_timer2 = TimerInit() ;============================================================================================ EndIf EndIf WEnd EndFunc ;==>_tray Edited March 9, 2010 by MariusN Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 9, 2010 Moderators Share Posted March 9, 2010 MariusN,You need to define $i_timer2 BEFORE you start your loop and then you need to reset it each time it is called, not just when the If statement is true.This runs every 2 seconds for me:expandcollapse popupOpt('MustDeclareVars', 1) Opt("TrayMenuMode", 3) _tray() Func _tray() Local $i_timer2, $test, $readtest, $MSG, $i_pid2, $s_stdout, $receive, $send, $var1, $rnd1, $rnd2, $rnd3, $rnd4, $var2 Local $open1, $read8, $open4, $write2, $open5, $read9, $open2, $read2, $open3, $open1, $open6, $open7, $read10, $i_timer, $fileLog, $fileLog2, $view, $exititem Local $write1, $read1, $total1, $read4, $read3, $i_timer Local $ip_sec = 1 $fileLog = (@ScriptDir & "\nrd3.txt") $fileLog2 = (@ScriptDir & "\total.log") $rnd3 = $rnd1 + $rnd2 $view = TrayCreateItem("View Live Feed") $exititem = TrayCreateItem("Exit") ;Opt('MustDeclareVars', 1) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Why declare twice? ;Opt("TrayMenuMode", 3) TraySetState() $i_timer2 = TimerInit() While 1 $MSG = TrayGetMsg() Select ;Case $MSG = 0 ; ContinueLoop Case $MSG = $view ;_Start() Case $MSG = $exititem Exit EndSelect If TimerDiff($i_timer2) / 1000 >= 2 Then MsgBox(0, "", "timerdiff") #cs $i_pid2 = Run(@ComSpec & " /c netstat -e", @SystemDir, @SW_HIDE, 6) While 1 $s_stdout &= StdoutRead($i_pid2) If @error Then ExitLoop EndIf WEnd If $s_stdout Then $receive = StringMid($s_stdout, 100, 17) $send = StringMid($s_stdout, 115, 17) $var1 = $receive / 1048576 $rnd1 = Round($var1, 3) $var2 = $send / 1048576 $rnd2 = Round($var2, 3) $rnd3 = $rnd1 + $rnd2 ;============================================================================================== $open5 = FileOpen($fileLog2, 0) $read3 = FileReadLine($open5, 1) FileClose($open5) If $read1 = $rnd3 Then Else $open1 = FileOpen($fileLog, 0) $read1 = FileReadLine($open1, 1) ; Total1 FileClose($open1) $open2 = FileOpen($fileLog, 2) $write1 = FileWriteLine($open2, $rnd3) ;Total2 FileClose($open2) $total1 = $rnd3 $open3 = FileOpen($fileLog2, 0) $read2 = FileReadLine($open3, 1) FileClose($open3) $open4 = FileOpen($fileLog2, 2) FileWriteLine($open4, $read2 + $rnd3 - $read1) FileClose($open4) $open6 = FileOpen($fileLog2, 0) $read4 = FileReadLine($open6, 1) FileClose($open6) EndIf $s_stdout = "" ;$i_timer2 = TimerInit() ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Remove from here ;============================================================================================ EndIf #ce $i_timer2 = TimerInit() ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Add here EndIf WEnd EndFunc ;==>_trayLook for the <<<<<<<<<<<<<< lines. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
MariusN Posted March 10, 2010 Author Share Posted March 10, 2010 thx Melba Weird that if a person code long hours, you start missing things ...lol 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