Jump to content

Recommended Posts

Posted

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 ?

  • Moderators
Posted (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 general

Some 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 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.

Posted

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)
  • 10 months later...
Posted

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)

Func 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 :D

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...