MariusN Posted March 4, 2010 Share Posted March 4, 2010 (edited) 1st code: This one works $tester = _FileWriteToLine(@ScriptDir & "\netstat.log", 2, "123", 1) 2nd code This one DOESNT work $tester = _FileWriteToLine($fileLog, 2, $rnd3, 1) My "checkers" so to speak These codes below returns the value 100% MsgBox(0,"",$fileLog); <---these 2 Boxes are placed DIRECTLY BELOW the 2nd code... MsgBox(0,"",$rnd3) Is there something i'm missing as it seems that the FIRST code (without the variables) works, but as soon as i replace it with $fileLog or $rnd3 (as can be seen in the 2nd code) it doesnt work...Can someone maybe explain me whats wrong? #include <File.au3> IS in the header... Edited March 4, 2010 by MariusN Link to comment Share on other sites More sharing options...
99ojo Posted March 4, 2010 Share Posted March 4, 2010 (edited) Hi, we can't debug your 2nd code. How are the variables $fileLog and $rnd3 declared? Post more code. ;-)) Stefan @Edit This fails, if file is empty. If not it works perfect, if you want line 2 to be overwritten: #include <file.au3> $fileLog = @ScriptDir & "\test.log" $rnd3 = "Some text" $tester = _FileWriteToLine($fileLog, 2, $rnd3, 1) ShellExecute ("notepad.exe", $fileLog) Edited March 4, 2010 by 99ojo Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 4, 2010 Moderators Share Posted March 4, 2010 MariusN,What exactly is in the $fileLog variable when you test it? Does it include the full path? 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 4, 2010 Author Share Posted March 4, 2010 (edited) Hi, we can't debug your 2nd code. How are the variables $fileLog and $rnd3 declared? Post more code. ;-)) Stefan @Edit This fails, if file is empty. If not it works perfect: #include <file.au3> $fileLog = @ScriptDir & "\test.log" $rnd3 = "Some text" $tester = _FileWriteToLine($fileLog, 2, $rnd3, 1) ShellExecute ("notepad.exe", $fileLog) What boggles my brain is the fact that the "messageboxes" displays the correct info...know what i mean? The code is still VERY sloppy as i'm still in the beginning stadges of this program so obviously there will be bugs, but here goes...my complete code so far... expandcollapse popup#include <WindowsConstants.au3> #include <StaticConstants.au3> #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <File.au3> Opt('MustDeclareVars', 1) Opt("TrayMenuMode", 3) Global $h_gui, $i_edit, $h_edit, $receive, $send, $fileLog, $fileLog2, $open1, $i_timer2, $MSG, $view, $var3, $open4, $open5, $read3 Global $s_stdout, $i_pid, $i_timer, $i_edit2, $var1, $var2, $rnd1, $rnd2, $exititem, $log, $open2, $open3, $read1, $read2, $rnd3 Global $s_ip = @IPAddress1 Global $i_sec = 1 Global $tester $fileLog = (@ScriptDir & "\netstat.log") If FileExists(@ScriptDir & "\netstat.log") Then ;will keep CURRENT + HISTORY (netstat.log) bytes added together Else _FileCreate(@ScriptDir & "\netstat.log") EndIf $fileLog2 = (@SystemDir & "\netbackup.txt") If FileExists(@SystemDir & "\netbackup.txt") Then ;Backs-Up bytes in netstat.log Else _FileCreate(@SystemDir & "\netbackup.txt") EndIf $view = TrayCreateItem("View Live Feed") $log = TrayCreateItem("View Log") $exititem = TrayCreateItem("Exit") Func _Start() GUICreate("Network Monitor on IP: " & $s_ip, 250, 150, -1, 20) GUICtrlCreateLabel("Receive: (Mb)", 20, 30, 120, 20) GUICtrlCreateLabel("Send: (Mb)", 130, 30, 120, 20) GUICtrlCreateLabel("Total: (Mb)", 90, 80, 120, 20) $i_edit = GUICtrlCreateLabel("", 20, 50, 200, 20, $SS_SUNKEN) $i_edit2 = GUICtrlCreateLabel("", 70, 100, 100, 20, $SS_SUNKEN) GUISetState() $h_edit = GUICtrlGetHandle($i_edit) $i_timer = TimerInit() While 1 $MSG = GUIGetMsg() Select Case $MSG = $GUI_EVENT_CLOSE ExitLoop EndSelect If TimerDiff($i_timer) / 1000 > 1 Then $i_pid = Run(@ComSpec & " /c netstat -e", @SystemDir, @SW_HIDE, 6) While 1 $s_stdout &= StdoutRead($i_pid) If @error Then ExitLoop WEnd If $s_stdout Then $receive = StringMid($s_stdout, 100, 17) $send = StringMid($s_stdout, 115, 17) WinSetState($h_edit, "", @SW_LOCK) GUICtrlSetData($i_edit, "") $var1 = $receive / 1048576 $rnd1 = Round($var1, 3) $var2 = $send / 1048576 $rnd2 = Round($var2, 3) $rnd3 = $rnd1 + $rnd2 GUICtrlSetData($i_edit, " " & $rnd1 & " " & $rnd2) GUICtrlSetData($i_edit2, " " & $rnd3);$rnd1 + $rnd2) WinSetState($h_edit, "", @SW_UNLOCK) $open1 = FileOpen($fileLog, 2) FileWrite($fileLog, $rnd1 + $rnd2 & @CRLF) FileClose($open1) EndIf $s_stdout = "" $i_timer = TimerInit() EndIf WEnd GUIDelete() EndFunc ;==>_Start Func _log() $i_pid = Run(@ComSpec & " /c netstat -e", @SystemDir, @SW_HIDE, 6) While 1 $s_stdout &= StdoutRead($i_pid) If @error Then ExitLoop WEnd If $s_stdout Then $receive = StringMid($s_stdout, 100, 17) $send = StringMid($s_stdout, 115, 17) WinSetState($h_edit, "", @SW_LOCK) GUICtrlSetData($i_edit, "") $var1 = $receive / 1048576 $rnd1 = Round($var1, 3) $var2 = $send / 1048576 $rnd2 = Round($var2, 3) $rnd3 = $rnd1 + $rnd2 GUICtrlSetData($i_edit, " " & $rnd1 & " " & $rnd2) GUICtrlSetData($i_edit2, " " & $rnd3);$rnd1 + $rnd2) WinSetState($h_edit, "", @SW_UNLOCK) $open1 = FileOpen($fileLog, 2) FileWrite($fileLog, $rnd1 + $rnd2 & @CRLF) FileClose($open1) EndIf EndFunc ;==>_log _tray() Func _tray() TraySetState() While 1 $MSG = TrayGetMsg() If TimerDiff($i_timer) / 1000 > 30 Then $i_pid = Run(@ComSpec & " /c netstat -e", @SystemDir, @SW_HIDE, 6) While 1 $s_stdout &= StdoutRead($i_pid) If @error Then ExitLoop WEnd If $s_stdout Then $receive = StringMid($s_stdout, 100, 17) $send = StringMid($s_stdout, 115, 17) WinSetState($h_edit, "", @SW_LOCK) GUICtrlSetData($i_edit, "") $var1 = $receive / 1048576 $rnd1 = Round($var1, 3) $var2 = $send / 1048576 $rnd2 = Round($var2, 3) $rnd3 = $rnd1 + $rnd2 GUICtrlSetData($i_edit, " " & $rnd1 & " " & $rnd2) GUICtrlSetData($i_edit2, " " & $rnd1 + $rnd2) WinSetState($h_edit, "", @SW_UNLOCK) _Replace() EndIf $s_stdout = "" $i_timer = TimerInit() EndIf Select Case $MSG = 0 ContinueLoop Case $MSG = $view _Start() Case $MSG = $log _log() Sleep(10) Run("notepad.exe " & @ScriptDir & "\netstat.log") Case $MSG = $exititem Exit EndSelect WEnd EndFunc ;==>_tray Func _Replace() $rnd3 = $rnd1 + $rnd2 $open1 = FileOpen($fileLog, 2) FileWrite($fileLog, $rnd3 & @CRLF) FileClose($open1) $open2 = FileOpen($fileLog, 0) $read1 = FileReadLine($open2, 1) $read2 = FileReadLine($open2, 2) FileClose($open2) If $read1 <> "" Or $read1 > 0 Then FileOpen($fileLog,1) $tester = _FileWriteToLine($fileLog, 2, $rnd3, 1)<---Here is the prob!!! MsgBox(0,"",$fileLog) MsgBox(0,"",$rnd3) $open3 = FileOpen($fileLog2, 0) $read3 = FileReadLine($open3, 1) FileClose($open3) Sleep(20) If $read2 < $read3 Then $open4 = FileOpen($fileLog2, 2) FileWriteLine($fileLog2, $read2) FileClose($open4) Else $open5 = FileOpen($fileLog2, 2) FileWriteLine($fileLog2, $read1) FileClose($open5) EndIf EndIf EndFunc The TRAY and REPLACE section is my concern as its running in the background...the other stuff ill sort out later Edited March 4, 2010 by MariusN Link to comment Share on other sites More sharing options...
MariusN Posted March 4, 2010 Author Share Posted March 4, 2010 (edited) Hi, we can't debug your 2nd code. How are the variables $fileLog and $rnd3 declared? Post more code. ;-)) Stefan @Edit This fails, if file is empty. If not it works perfect, if you want line 2 to be overwritten: #include <file.au3> $fileLog = @ScriptDir & "\test.log" $rnd3 = "Some text" $tester = _FileWriteToLine($fileLog, 2, $rnd3, 1) ShellExecute ("notepad.exe", $fileLog) Seems this code of yours also doesnt want to work...so i guess ill check my pc and reinstall AutoIt Edited March 4, 2010 by MariusN Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 4, 2010 Moderators Share Posted March 4, 2010 MariusN, It looks as if you are trying to open an already open file: FileOpen($fileLog,1) $tester = _FileWriteToLine($fileLog, 2, $rnd3, 1)<---Here is the prob!!!You open the file with FileOpen and then _FileWriteToLine finds that the file is locked. Did you check the return value of $tester?By the way, you are mixing up file names and file handles in your various FileWrite commands - you should only use one or the other. From the Help file for FileWrite:Note: Do not mix filehandles and filenames, i.e., don't FileOpen a file and then use a filename in this function. Either use filehandles or filenames in your routines, not both.You currently use:$open1 = FileOpen($fileLog, 2)FileWrite($fileLog, $rnd3 & @CRLF)FileClose($open1)You should use one of these: $open1 = FileOpen($fileLog, 2) FileWrite($open1, $rnd3 & @CRLF) FileClose($open1) ; or FileWrite($fileLog, $rnd3 & @CRLF) Of course, when you use the _FileWrite style commands, you must use a file name only. Take care using any file commands and make sure you are using the correct syntax - it often catches you out! 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 4, 2010 Author Share Posted March 4, 2010 (edited) MariusN, It looks as if you are trying to open an already open file: FileOpen($fileLog,1) $tester = _FileWriteToLine($fileLog, 2, $rnd3, 1)<---Here is the prob!!!You open the file with FileOpen and then _FileWriteToLine finds that the file is locked. Did you check the return value of $tester?By the way, you are mixing up file names and file handles in your various FileWrite commands - you should only use one or the other. From the Help file for FileWrite:Note: Do not mix filehandles and filenames, i.e., don't FileOpen a file and then use a filename in this function. Either use filehandles or filenames in your routines, not both.You currently use:$open1 = FileOpen($fileLog, 2)FileWrite($fileLog, $rnd3 & @CRLF)FileClose($open1)You should use one of these: $open1 = FileOpen($fileLog, 2) FileWrite($open1, $rnd3 & @CRLF) FileClose($open1) ; or FileWrite($fileLog, $rnd3 & @CRLF) Of course, when you use the _FileWrite style commands, you must use a file name only. Take care using any file commands and make sure you are using the correct syntax - it often catches you out! M23 Yes...the $filelog was only a test M23... Btw, the above code posted by 99ojo also doesnt want to work...so i think i got some $%## going on on my pc I have uninstalled AND reinstalled AutIt + Scite, but to no avail...The thing i can think of is a corrupted <file.au3> or a background debugger im running (Syser Loader) ...but thanks for all the help guys...much appreciated... PS: the reason for the code looking VERU UP RO Sh*t is because of all the different "styles" i tried to get this freakin "_FileWriteToLine" to work... OOPS...my correction...You said a guy HAS to use a filename and NOT a VAR as a filename... Edited March 4, 2010 by MariusN Link to comment Share on other sites More sharing options...
MariusN Posted March 4, 2010 Author Share Posted March 4, 2010 Sorry M23, just a last question...So there is NO other way to write to line no.2 except using the _FileWriteToLine? I see that it doesnt take ANY variable...not even the $rnd3 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 4, 2010 Moderators Share Posted March 4, 2010 MariusN,What are you talking about? _FileWriteToLine works perfectly well with variables. Run this:#Include <File.au3> $hFile = FileOpen(@ScriptDir & "\test.txt", 2) FileWrite($hFile, "Line 1" & @CRLF & "Line 2" & @CRLF & "Line 3") FileClose($hFile) MsgBox(0, "Pause", "Go and read the file!") _FileWriteToLine(@ScriptDir & "\test.txt", 1, "Replacing Line 1", 1) MsgBox(0, "Pause", "Go and read the file!") $sFilename = @ScriptDir & "\test.txt" _FileWriteToLine($sFilename, 2, "Replacing Line 2", 1) MsgBox(0, "Pause", "Go and read the file!") $sText = "Replacing Line 3" _FileWriteToLine($sFilename, 3, $stext, 1) MsgBox(0, "Pause", "Go and read the file!")I have told you what your problem is - you are trying to open an already open file. Go and put your various FileWrite and _FileWriteToLine commands in the corerct syntax and make sure you close the files if you have opened them. 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 4, 2010 Author Share Posted March 4, 2010 MariusN, What are you talking about? _FileWriteToLine works perfectly well with variables. Run this: #Include <File.au3> $hFile = FileOpen(@ScriptDir & "\test.txt", 2) FileWrite($hFile, "Line 1" & @CRLF & "Line 2" & @CRLF & "Line 3") FileClose($hFile) MsgBox(0, "Pause", "Go and read the file!") _FileWriteToLine(@ScriptDir & "\test.txt", 1, "Replacing Line 1", 1) MsgBox(0, "Pause", "Go and read the file!") $sFilename = @ScriptDir & "\test.txt" _FileWriteToLine($sFilename, 2, "Replacing Line 2", 1) MsgBox(0, "Pause", "Go and read the file!") $sText = "Replacing Line 3" _FileWriteToLine($sFilename, 3, $stext, 1) MsgBox(0, "Pause", "Go and read the file!") I have told you what your problem is - you are trying to open an already open file. Go and put your various FileWrite and _FileWriteToLine commands in the corerct syntax and make sure you close the files if you have opened them. M23 Okkkk....fair...Laugh your backsides off, LOL, but you wont believe this...I have done as you said BY THE LETTER... This is what happens 2 me now...With this code (after fixing al the "open files and closing them neatly", the ""$tester = _FileWriteToLine(c:\myfile.txt, 2, $rnd3, 1)"" line won't accept the ""$rnd3"" entry....BUT, as soon as i ADD (""&) (the digits between the brackets) just in front of the ""$rnd3"" entry..., it works 100%....Now TRUELY i think i got some software probs...either my <File.au3> or something else...Thing is why i say this, is either something works, or not...not so? Anyways M23...i really appreciate the help, but not 2 worry...i think my PC's software needs attention, as sometimes, believe it or not, if i'm IN Scite, clicking on a function, and then hit F1, nothing works...Then, if i move to ANOTHER function (lets say +- 2 or so line below and do the EXACT same thing), Scite will respond...Aint this weired??? but not 2 worry eh? nothing is "unrepairable" Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 4, 2010 Moderators Share Posted March 4, 2010 MaruisN,So show me the code now you have "fixed it" and I will take aother look. I very much doubt you have a corrupted AutoIt installation. M23P.S. When you reply please use the "Add Reply" button at the top and bottom of the page rather then the "Reply" button in the post itself. That way you do not get the contents of the previous post quoted in your reply and the whole thread becomes easier to read. 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 4, 2010 Author Share Posted March 4, 2010 Ok M23...Now i want you to look ate the bottom of the code...thats what i cant figure out...It's working now with the ""& i have added just infront of $rnd3 (weird but true) expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=..\..\Icons\Aeon_Icon_Pack\Misc\Search.ico #AutoIt3Wrapper_Outfile=BandMon.exe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <File.au3> Opt('MustDeclareVars', 1) Opt("TrayMenuMode", 3) Global $h_gui, $i_edit, $h_edit, $receive, $send, $fileLog, $fileLog2, $open1, $i_timer2, $MSG, $view, $var3, $open4, $open5, $read3 Global $s_stdout, $i_pid, $i_timer, $i_edit2, $var1, $var2, $exititem, $log, $open2, $open3, $read1, $read2,$rnd1, $rnd2, $rnd3 Global $s_ip = @IPAddress1 Global $i_sec = 1 Global $tester $rnd3 = $rnd1 + $rnd2 $fileLog = (@ScriptDir & "\netstat.log") If FileExists(@ScriptDir & "\netstat.log") Then ;will keep CURRENT + HISTORY (netstat.log) bytes added together Else _FileCreate(@ScriptDir & "\netstat.log") EndIf $fileLog2 = (@SystemDir & "\netbackup.txt") If FileExists(@SystemDir & "\netbackup.txt") Then ;Backs-Up bytes in netstat.log Else _FileCreate(@SystemDir & "\netbackup.txt") EndIf $view = TrayCreateItem("View Live Feed") $log = TrayCreateItem("View Log") $exititem = TrayCreateItem("Exit") Func _Start() GUICreate("Network Monitor on IP: " & $s_ip, 250, 150, -1, 20) GUICtrlCreateLabel("Receive: (Mb)", 20, 30, 120, 20) GUICtrlCreateLabel("Send: (Mb)", 130, 30, 120, 20) GUICtrlCreateLabel("Total: (Mb)", 90, 80, 120, 20) $i_edit = GUICtrlCreateLabel("", 20, 50, 200, 20, $SS_SUNKEN) $i_edit2 = GUICtrlCreateLabel("", 70, 100, 100, 20, $SS_SUNKEN) GUISetState() $h_edit = GUICtrlGetHandle($i_edit) $i_timer = TimerInit() While 1 $MSG = GUIGetMsg() Select Case $MSG = $GUI_EVENT_CLOSE ExitLoop EndSelect If TimerDiff($i_timer) / 1000 > 1 Then $i_pid = Run(@ComSpec & " /c netstat -e", @SystemDir, @SW_HIDE, 6) While 1 $s_stdout &= StdoutRead($i_pid) If @error Then ExitLoop WEnd If $s_stdout Then $receive = StringMid($s_stdout, 100, 17) $send = StringMid($s_stdout, 115, 17) WinSetState($h_edit, "", @SW_LOCK) GUICtrlSetData($i_edit, "") $var1 = $receive / 1048576 $rnd1 = Round($var1, 3) $var2 = $send / 1048576 $rnd2 = Round($var2, 3) GUICtrlSetData($i_edit, " " & $rnd1 & " " & $rnd2) GUICtrlSetData($i_edit2, " " & $rnd3);$rnd1 + $rnd2) WinSetState($h_edit, "", @SW_UNLOCK) EndIf $s_stdout = "" $i_timer = TimerInit() EndIf WEnd GUIDelete() EndFunc ;==>_Start _tray() Func _tray() TraySetState() While 1 $MSG = TrayGetMsg() If TimerDiff($i_timer) / 1000 > 2 Then $i_pid = Run(@ComSpec & " /c netstat -e", @SystemDir, @SW_HIDE, 6) While 1 $s_stdout &= StdoutRead($i_pid) If @error Then ExitLoop WEnd If $s_stdout Then $receive = StringMid($s_stdout, 100, 17) $send = StringMid($s_stdout, 115, 17) WinSetState($h_edit, "", @SW_LOCK) GUICtrlSetData($i_edit, "") $var1 = $receive / 1048576 $rnd1 = Round($var1, 3) $var2 = $send / 1048576 $rnd2 = Round($var2, 3) GUICtrlSetData($i_edit, " " & $rnd1 & " " & $rnd2) GUICtrlSetData($i_edit2, " " & $rnd1 + $rnd2) WinSetState($h_edit, "", @SW_UNLOCK) _Replace() EndIf $s_stdout = "" $i_timer = TimerInit() EndIf Select Case $MSG = 0 ContinueLoop Case $MSG = $view _Start() Case $MSG = $log Run("notepad.exe " & @ScriptDir & "\netstat.log") Case $MSG = $exititem Exit EndSelect WEnd EndFunc ;==>_tray Func _Replace() $rnd3 = $rnd1 + $rnd2 $open2 = FileOpen($fileLog, 0) $read1 = FileReadLine($open2, 1) $read2 = FileReadLine($open2, 2) FileClose($open2) If $read1 <> "" Or $read1 > 0 Then _FileWriteToLine(@ScriptDir & "\netstat.log", 2, ""&$rnd3, 1);<---check the ""& $open3 = FileOpen($fileLog2, 0) $read3 = FileReadLine($open3, 1) FileClose($open3) Sleep(20) If $read2 < $read3 Then $open4 = FileOpen($fileLog2, 2) FileWriteLine($open4, $read2) FileClose($open4) Else $open5 = FileOpen($fileLog2, 2) FileWriteLine($open5, $read1) FileClose($open5) EndIf Else $open1 = FileOpen($fileLog, 1) FileWrite($open1, $rnd3 & @CRLF) FileClose($open1) EndIf EndFunc ;==>_Replace Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 4, 2010 Moderators Share Posted March 4, 2010 MariusN, Works for me both with and without the ""&. Must be magic! Anyway, you have it working and that is the main thing. 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 4, 2010 Author Share Posted March 4, 2010 (edited) you wont believe it, but this was driving me NUTS! I'm still going to get to the bottom of this as it doesnt make sense, eh? lol Thx for your help anyways M23 PS: it still needs a hell of a lot of coding, calculations, etc....then youre going to watch this baby fly Edited March 4, 2010 by MariusN 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