Autoit-Suchmaschine

  • hier is ma nen bsp:

    [autoit]

    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Search Test", 371, 213, 192, 124)
    $Edit1 = GUICtrlCreateEdit("", 0, 0, 369, 169, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN))
    GUICtrlSetData(-1, "This is a Test.")
    $Label1 = GUICtrlCreateLabel("Word:", 40, 176, 33, 17)
    GUICtrlCreateInput("", 80, 176, 193, 21)
    $Button1 = GUICtrlCreateButton("Search", 280, 176, 75, 25, $WS_GROUP)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit][autoit][/autoit][autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

    [/autoit][autoit][/autoit][autoit]

    EndSwitch
    WEnd

    [/autoit]

    wenn das wort erfolgreich gefunden wurde,soll ne msg kommen mit den wort.

    mfg

  • StringInStr() ist das Zauberwort!

    [autoit]

    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Search Test", 371, 213, 192, 124)
    $Edit1 = GUICtrlCreateEdit("", 0, 0, 369, 169, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN))
    GUICtrlSetData(-1, "This is a Test.")
    $Label1 = GUICtrlCreateLabel("Word:", 40, 176, 33, 17)
    $Input1 = GUICtrlCreateInput("", 80, 176, 193, 21)
    $Button1 = GUICtrlCreateButton("Search", 280, 176, 75, 25, $WS_GROUP)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit][autoit][/autoit][autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    $pos = StringInStr(GUICtrlRead($Edit1),GUICtrlRead($Input1))
    If $pos > 0 Then MsgBox(0,"","Gefunden an Position "&$pos)
    EndSwitch
    WEnd

    [/autoit]
  • Das Wort steht doch im Suchfeld?!

    Edit:

    [autoit]

    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>

    [/autoit][autoit][/autoit][autoit]

    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Search Test", 371, 213, 192, 124)
    $Edit1 = GUICtrlCreateEdit("", 0, 0, 369, 169, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN))
    GUICtrlSetData(-1, "This is a Test.")
    $Label1 = GUICtrlCreateLabel("Word:", 40, 176, 33, 17)
    $Input1 = GUICtrlCreateInput("", 80, 176, 193, 21)
    $Button1 = GUICtrlCreateButton("Search", 280, 176, 75, 25, $WS_GROUP)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit][autoit][/autoit][autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    $match = StringRegExp(GUICtrlRead($Edit1),"\b[\d\w]*"&GUICtrlRead($Input1)&"[\d\w]*\b",3)
    MsgBox(0,"",UBound($match)&" Treffer!")
    For $i = 0 To UBound($match)-1
    MsgBox(0,"",$match[$i])
    Next
    EndSwitch
    WEnd

    [/autoit]