Rahul Rohela Posted June 12, 2006 Share Posted June 12, 2006 Hi, I am trying to read GUIEdit control & want to display only line that contain Secial word for example error. If i save GUIEdit input to text file then its possible but directly from EDIT its not happening. Please help on it. Script attached expandcollapse popup#include <GUIConstants.au3> #Include <GuiEdit.au3> GUICreate("My GUI edit") ; will create a dialog box that when displayed is centered $myedit=GUICtrlCreateEdit ("First line"& @CRLF, -1,-1,400,350,$ES_AUTOVSCROLL+$WS_VSCROLL) GUISetState () ; will be append dont' forget 3rd parameter GUICtrlSetData ($myedit, "error One line"& @CRLF,1) GUICtrlSetData ($myedit, "Second line"& @CRLF,1) GUICtrlSetData ($myedit, "error two line"& @CRLF,1) GUICtrlSetData ($myedit, " Second line"& @CRLF,1) GUICtrlSetData ($myedit, " Second line"& @CRLF,1) GUICtrlSetData ($myedit, " Second line"& @CRLF,1) GUICtrlSetData ($myedit, "error three line"& @CRLF,1) GUICtrlSetData ($myedit, " Second line"& @CRLF,1) ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop Wend ;$FileRead = GUICtrlRead($myedit) $Count_Live = _GUICtrlEditGetLineCount($myedit) msgbox(0,"count",$Count_Live) $i1 = 1 Do $FileRead = GUICtrlRead($myedit) $tmp = StringInStr($FileRead,"Error") If $tmp = 0 then $i1 = $i1 + 1 Else MSGBOX(0,"line",$FileRead) $i1 = $i1 + 1 EndIf Until $i1 = $Count_Live +1 Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted June 12, 2006 Share Posted June 12, 2006 u want to read it to a text file or something #include <GUIConstants.au3> #Include <GuiEdit.au3> #include <File.au3> GUICreate("My GUI edit") ; will create a dialog box that when displayed is centered $myedit=GUICtrlCreateEdit ("First line"& @CRLF, -1,-1,400,350,$ES_AUTOVSCROLL+$WS_VSCROLL) GUISetState () ; will be append dont' forget 3rd parameter GUICtrlSetData ($myedit, "error One line"& @CRLF,1) GUICtrlSetData ($myedit, "Second line"& @CRLF,1) GUICtrlSetData ($myedit, "error two line"& @CRLF,1) GUICtrlSetData ($myedit, " Second line"& @CRLF,1) GUICtrlSetData ($myedit, " Second line"& @CRLF,1) GUICtrlSetData ($myedit, " Second line"& @CRLF,1) GUICtrlSetData ($myedit, "error three line"& @CRLF,1) GUICtrlSetData ($myedit, " Second line"& @CRLF,1) ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop Wend _FileCreate("test.txt") $file = "test.txt" FileWrite($file,GUICtrlRead($myedit)) For $i = 1 to _FileCountLines($file) MsgBox(0,"Lines",FileReadLine($file,$i)) Next Exit Link to comment Share on other sites More sharing options...
Rahul Rohela Posted June 12, 2006 Author Share Posted June 12, 2006 u want to read it to a text file or something #include <GUIConstants.au3> #Include <GuiEdit.au3> #include <File.au3> GUICreate("My GUI edit") ; will create a dialog box that when displayed is centered $myedit=GUICtrlCreateEdit ("First line"& @CRLF, -1,-1,400,350,$ES_AUTOVSCROLL+$WS_VSCROLL) GUISetState () ; will be append dont' forget 3rd parameter GUICtrlSetData ($myedit, "error One line"& @CRLF,1) GUICtrlSetData ($myedit, "Second line"& @CRLF,1) GUICtrlSetData ($myedit, "error two line"& @CRLF,1) GUICtrlSetData ($myedit, " Second line"& @CRLF,1) GUICtrlSetData ($myedit, " Second line"& @CRLF,1) GUICtrlSetData ($myedit, " Second line"& @CRLF,1) GUICtrlSetData ($myedit, "error three line"& @CRLF,1) GUICtrlSetData ($myedit, " Second line"& @CRLF,1) ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop Wend _FileCreate("test.txt") $file = "test.txt" FileWrite($file,GUICtrlRead($myedit)) For $i = 1 to _FileCountLines($file) MsgBox(0,"Lines",FileReadLine($file,$i)) Next Exit I dont want to read all lines form edit controll to text file.. i want it should write linses those have some special word like Error in example.. if it works this will write only lines error One line error two line error three line Link to comment Share on other sites More sharing options...
Rahul Rohela Posted June 13, 2006 Author Share Posted June 13, 2006 NO Suggestions...... Link to comment Share on other sites More sharing options...
Xenobiologist Posted June 13, 2006 Share Posted June 13, 2006 Hi, there are of course better ways, but is that what you wanted? Hit a while GUI is open to check the func's output. expandcollapse popup#include <GUIConstants.au3> #Include <GuiEdit.au3> #include<Array.au3> HotKeySet("a", "a") GUICreate("My GUI edit"); will create a dialog box that when displayed is centered $myedit = GUICtrlCreateEdit("First line" & @CRLF, -1, -1, 400, 350, $ES_AUTOVSCROLL + $WS_VSCROLL) GUISetState() ; will be append dont' forget 3rd parameter GUICtrlSetData($myedit, "error One line" & @CRLF, 1) GUICtrlSetData($myedit, "Second line" & @CRLF, 1) GUICtrlSetData($myedit, "error two line" & @CRLF, 1) GUICtrlSetData($myedit, " Second line" & @CRLF, 1) GUICtrlSetData($myedit, " Second line" & @CRLF, 1) GUICtrlSetData($myedit, " Second line" & @CRLF, 1) GUICtrlSetData($myedit, "error three line" & @CRLF, 1) GUICtrlSetData($myedit, " Second line" & @CRLF, 1) ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd Func a() $a = StringSplit(GUICtrlRead($myedit), Chr(13)) Global $b[1] $y = 1 For $i = 1 To UBound($a) - 1 If StringInStr($a[$i], "error") <> 0 Then _ArrayAdd($b, $a[$i]) $b[$y] = $a[$i] $y += 1 ConsoleWrite($a[$i]) EndIf Next _ArrayDisplay($b, "Error lines") EndFunc ;==>a So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Rahul Rohela Posted June 14, 2006 Author Share Posted June 14, 2006 Thx Function is working fine... But i am trying to add this output to at end of edit box... is it possible if yes then how??? Link to comment Share on other sites More sharing options...
Xenobiologist Posted June 14, 2006 Share Posted June 14, 2006 HI, something like this? expandcollapse popup#include <GUIConstants.au3> #Include <GuiEdit.au3> #include<Array.au3> HotKeySet("a", "a") GUICreate("My GUI edit"); will create a dialog box that when displayed is centered $myedit = GUICtrlCreateEdit("First line" & @CRLF, -1, -1, 400, 350, $ES_AUTOVSCROLL + $WS_VSCROLL) GUISetState() ; will be append dont' forget 3rd parameter GUICtrlSetData($myedit, "error One line" & @CRLF, 1) GUICtrlSetData($myedit, "Second line" & @CRLF, 1) GUICtrlSetData($myedit, "error two line" & @CRLF, 1) GUICtrlSetData($myedit, " Second line" & @CRLF, 1) GUICtrlSetData($myedit, " Second line" & @CRLF, 1) GUICtrlSetData($myedit, " Second line" & @CRLF, 1) GUICtrlSetData($myedit, "error three line" & @CRLF, 1) GUICtrlSetData($myedit, " Second line" & @CRLF, 1) ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd Func a() $a = StringSplit(GUICtrlRead($myedit), Chr(13)) Global $b[1] $y = 1 For $i = 1 To UBound($a) - 1 If StringInStr($a[$i], "error") <> 0 Then _ArrayAdd($b, $a[$i]) $b[$y] = $a[$i] $y += 1 ConsoleWrite($a[$i]) GUICtrlSetData($myedit, GUICtrlRead($myedit) & $a[$i] & Chr(13)) EndIf Next _ArrayDisplay($b, "Error lines") EndFunc ;==>a So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Rahul Rohela Posted June 14, 2006 Author Share Posted June 14, 2006 Thx Its working.... Link to comment Share on other sites More sharing options...
Xenobiologist Posted June 14, 2006 Share Posted June 14, 2006 Thx Its working....HI,glad I could help. But the func isn't very well coded. :"> So long,Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times 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