yxrkt Posted March 11, 2007 Share Posted March 11, 2007 CODE$search = InputBox("search", "", "", "") $contentmyedit = GUICtrlRead($myedit) $searchresult = StringInStr($contentmyedit,$search) SETFUCKINGFOCUS($myedit,$searchresult) <-- ? is there a function or something that highlights the search-result in my edit ? Link to comment Share on other sites More sharing options...
Shevilie Posted March 11, 2007 Share Posted March 11, 2007 What kind of object is $myedit ?? GUIEdit ?? Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
yxrkt Posted March 11, 2007 Author Share Posted March 11, 2007 What kind of object is $myedit ?? GUIEdit ??sorry forgot.. yep its GUIedit. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 11, 2007 Moderators Share Posted March 11, 2007 (edited) CODE$search = InputBox("search", "", "", "")$contentmyedit = GUICtrlRead($myedit)$searchresult = StringInStr($contentmyedit,$search)SETFUCKINGFOCUS($myedit,$searchresult) <-- ?is there a function or something that highlights the search-result in my edit ?_GUICtrlEditGetSel/_GUICtrlEditSetSel/or _GUICtrlEdit* in generalSome effort on your part to customize it to fit your needs will be in order... or you can search for these on the forum to see how others do it.Also... _GUICtrlEditFind Edited March 11, 2007 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
yxrkt Posted March 14, 2007 Author Share Posted March 14, 2007 Thank you for pointing me to _GuiGtrlEditSetSel. Here's the code. $search = InputBox("search", "", "", "") $contentmyedit = GUICtrlRead($myedit) $searchresult = StringInStr($contentmyedit,$search) $searchlenght = StringLen($search) $searchresult1 = $searchresult - 1 $searchresult2 = $searchresult + $searchlenght - 1 _guictrleditsetsel($myedit,$searchresult1 , $searchresult2) _GUICtrlEditScroll($myedit, $SB_SCROLLCARET) Link to comment Share on other sites More sharing options...
SxyfrG Posted January 27, 2008 Share Posted January 27, 2008 Thanks yxrt. I used some of your code in my own version of notepad (i also added a find next function just be replacing the 1 in StringInStr with a variable which is changed everytime you perform the find next function) expandcollapse popupFunc SearchButton() $ReadInputS = GUICtrlRead ( $SearchInput ) $ReadInputR = GUICtrlRead ( $ReplaceInput ) $CaseMatch = GUICtrlRead ( $MatchCase ) $ReplaceCheck = GUICtrlRead ( $SearchReplaceChkBox ) If $CaseMatch = 1 Then $MatchCase1 = 1 Else $MatchCase1 = 0 EndIf If $ReadInputS = "" Then Else $contentmyedit = GUICtrlRead($Text) $searchresult = StringInStr($contentmyedit,$ReadInputS,$MatchCase1,1) If $searchresult = 0 Then MsgBox ( 48 , "Error!" , "Reached end of document." ) Else $searchlenght = StringLen($ReadInputS) $searchresult1 = $searchresult - 1 $searchresult2 = $searchresult + $searchlenght - 1 _guictrleditsetsel($Text,$searchresult1 , $searchresult2) _GUICtrlEditScroll($Text, $SB_SCROLLCARET) If $ReplaceCheck = 1 Then _GUICtrlEditReplaceSel ( $Text , TRUE , $ReadInputR ) Else GUICtrlSetState ( $SearchReplaceChkBox , $GUI_ENABLE ) GUICtrlSetState ( $FindNButton , $GUI_ENABLE ) EndIf EndIf EndIf EndFunc Func SearchButtonN();Find next button $ReadInputS = GUICtrlRead ( $SearchInput ) $ReadInputR = GUICtrlRead ( $ReplaceInput ) $CaseMatch = GUICtrlRead ( $MatchCase ) $ReplaceCheck = GUICtrlRead ( $SearchReplaceChkBox ) If $CaseMatch = 1 Then $MatchCase1 = 1 Else $MatchCase1 = 0 EndIf If $ReadInputS = "" Then Else $contentmyedit = GUICtrlRead($Text) $searchresult = StringInStr($contentmyedit,$ReadInputS,$MatchCase1,$Search) If $searchresult = 0 Then MsgBox ( 48 , "Error!" , "Reached end of document." ) Else $searchlenght = StringLen($ReadInputS) $searchresult1 = $searchresult - 1 $searchresult2 = $searchresult + $searchlenght - 1 _guictrleditsetsel($Text,$searchresult1 , $searchresult2) _GUICtrlEditScroll($Text, $SB_SCROLLCARET) If $ReplaceCheck = 1 Then _GUICtrlEditReplaceSel ( $Text , TRUE , $ReadInputR ) Else GUICtrlSetState ( $SearchReplaceChkBox , $GUI_ENABLE ) GUICtrlSetState ( $FindNButton , $GUI_ENABLE ) EndIf EndIf $Search = $Search+1 EndIf EndFunc I have too much time on my hands My scripts:AppLauncherTRAY - Awesome app launcher that runs from the system tray NEW VERSION! | Run Length Encoding - VERY simple compression in pure autoit | Simple Minesweeper Game - Fun little game :)My website 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