VicVietCorp Posted April 27, 2011 Share Posted April 27, 2011 (edited) I want to code a tool for my work I'm thinking i will have a frame on my tool for input data: aaaaaaaaaaa|cccccc|dddddddd bbbbbbbb|cccccc|eeeeeeeeeeeeeeeeeeeeee ............... i want to find keyword "ccccccc" in that frame. Please help me. Sorry my English very bad Edited April 27, 2011 by VicVietCorp Link to comment Share on other sites More sharing options...
VicVietCorp Posted April 27, 2011 Author Share Posted April 27, 2011 Help me Link to comment Share on other sites More sharing options...
monoscout999 Posted April 27, 2011 Share Posted April 27, 2011 StringSplit() look that function... a question ¿the string you want to separate is on a program yours or is on another program window?? Link to comment Share on other sites More sharing options...
pieeater Posted April 28, 2011 Share Posted April 28, 2011 (edited) i wrote this code to tell you how many times it occurs in the data, as monoscout999 said check out what StringSplit() and you can change what its looking for. hope it helps expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <GuiEdit.au3> #include <Constants.au3> HotKeySet("{enter}", "button1") $Form1 = GUICreate("search", 600, 350) $edit1= GUICtrlCreateEdit("", 5, 5, 500, 150) $input1= GUICtrlCreateInput("search for what?", 5, 160, 500, 22) $edit2 = GUICtrlCreateEdit("Results", 5, 185, 500, 150) $button = GUICtrlCreateButton("open a txt file", 510, 5, 90, 30) $button2 = GUICtrlCreateButton("search", 510, 60, 90, 30) GUISetState(@SW_SHOW) while 1 $msg=GUIGetMsg() If $msg = -3 Then Exit If $msg = $button Then button() If $msg = $button2 Then button1() WEnd Func button() $message=("click shift to Select multiple files.") $var=FileOpenDialog($message,@desktopcommondir & "\","lists (*.txt)") $file=FileRead($var) If @error Then MsgBox(0,"","no file(s) were selected") Else GUICtrlSetData($edit1, $file) EndIf EndFunc Func button1() $search=ControlGetText("","",$input1) $data=ControlGetText("","",$edit1) $a=StringSplit($data,$search,1) ControlSetText("","",$edit2, "occures " & $a[0]-1 & " times") ; the -1 is so it doesn't count the input box as an entry EndFunc Edited April 28, 2011 by pieeater [spoiler]My UDFs: Login UDF[/spoiler] Link to comment Share on other sites More sharing options...
VicVietCorp Posted April 28, 2011 Author Share Posted April 28, 2011 (edited) As this image Thank you for reply, But i want to show result as line, no counter and show results wasn't keyword in orther label Edited April 28, 2011 by VicVietCorp Link to comment Share on other sites More sharing options...
VicVietCorp Posted April 28, 2011 Author Share Posted April 28, 2011 i wrote this code to tell you how many times it occurs in the data, as monoscout999 said check out what StringSplit() and you can change what its looking for. hope it helps expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <GuiEdit.au3> #include <Constants.au3> HotKeySet("{enter}", "button1") $Form1 = GUICreate("search", 600, 350) $edit1= GUICtrlCreateEdit("", 5, 5, 500, 150) $input1= GUICtrlCreateInput("search for what?", 5, 160, 500, 22) $edit2 = GUICtrlCreateEdit("Results", 5, 185, 500, 150) $button = GUICtrlCreateButton("open a txt file", 510, 5, 90, 30) $button2 = GUICtrlCreateButton("search", 510, 60, 90, 30) GUISetState(@SW_SHOW) while 1 $msg=GUIGetMsg() If $msg = -3 Then Exit If $msg = $button Then button() If $msg = $button2 Then button1() WEnd Func button() $message=("click shift to Select multiple files.") $var=FileOpenDialog($message,@desktopcommondir & "\","lists (*.txt)") $file=FileRead($var) If @error Then MsgBox(0,"","no file(s) were selected") Else GUICtrlSetData($edit1, $file) EndIf EndFunc Func button1() $search=ControlGetText("","",$input1) $data=ControlGetText("","",$edit1) $a=StringSplit($data,$search,1) ControlSetText("","",$edit2, "occures " & $a[0]-1 & " times") ; the -1 is so it doesn't count the input box as an entry EndFunc Thank you very much I'm thinking My tool have 4 input label Label 1: Input data by many line aaaaaaaaaaaaaaaaaaaa|111111|cccccccccccccc aaaaaaaaaaaaaaaaaaaa|111111|cccccccccccccc aaaaaaaaaaaaaaaaaaaa|111111|cccccccccccccc aaaaaaaaaaaaaaaaaaaa|111111|cccccccccccccc aaaaaaaaaaaaaaaaaaaa|222222222|cccccccccccccc aaaaaaaaaaaaaaaaaaaa|33333333|cccccccccccccc Label 2: Example: |111111| Input keyword Label 3: Show resutl by line aaaaaaaaaaaaaaaaaaaa|111111|cccccccccccccc aaaaaaaaaaaaaaaaaaaa|111111|cccccccccccccc aaaaaaaaaaaaaaaaaaaa|111111|cccccccccccccc aaaaaaaaaaaaaaaaaaaa|111111|ccccccccccccc Label 4: Show not result by line aaaaaaaaaaaaaaaaaaaa|222222222|cccccccccccccc aaaaaaaaaaaaaaaaaaaa|33333333|cccccccccccccc Link to comment Share on other sites More sharing options...
VicVietCorp Posted April 28, 2011 Author Share Posted April 28, 2011 Please help me Link to comment Share on other sites More sharing options...
Jayson Posted April 29, 2011 Share Posted April 29, 2011 (edited) As monoscout999 said in post use StringSplit() in the help file. It will tell you exactly how to do it Using StringSplit will put the data into an array. The first element ($array[0]) contains the number of strings returned, the remaining elements ($array[1], $array[2], etc.) is what you need as you can see few lines down$strings = StringSplit("aaaaaaaaaaa|cccccc|dddddddd", "|") ;$strings[1] contains "aaaaaaaaaaa" ;$strings[2] contains "cccccc" <========= This would be what you looking for ;$strings[3] contains "dddddddd" Edited April 29, 2011 by Jayson Link to comment Share on other sites More sharing options...
VicVietCorp Posted April 29, 2011 Author Share Posted April 29, 2011 You can code for me, Please help me. I can't Link to comment Share on other sites More sharing options...
Jayson Posted April 29, 2011 Share Posted April 29, 2011 (edited) I am sorry to say this but I'll not write everything for you. Try at least something and if you still ran into a problem we're here to help you ! If you want someone to make it for you, you can ask here. Edited April 29, 2011 by Jayson 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