#include #include #include #include #include #include #include #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("TextExpander", 451, 403, 336, 33) $IP = GUICtrlCreateInput("", 32, 304, 177, 21) ; GUICtrlCreateInput("", 240, 304, 177, 21) $Button1 = GUICtrlCreateButton("OK", 24, 344, 89, 33, $BS_DEFPUSHBUTTON) $Button2 = GUICtrlCreateButton("Add Entry", 136, 344, 105, 33) $Edit1 = GUICtrlCreateList("", 16, 8, 409, 279) $Button3 = GUICtrlCreateButton("Close", 352, 344, 65, 33) GUISetState(@SW_SHOW) LoadData () #EndRegion ### END Koda GUI section ### GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") Func LoadData () Local Const $sFilePath = @ScriptDir & "\Textexpander.txt" Local $hFileOpen = FileOpen($sFilePath, $FO_READ) $sData = fileread($hFileOpen) fileclose($hFileOpen) Global $MyVal = StringSplit($sData,"|") Global $possibles = stringreplace($sdata,@CRLF,'|') GUICtrlSetData($Edit1, $possibles) EndFunc While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Local $hdlWindowFrom, _ $intControlID_From, _ $intMessageCode, _ $strSearchString = "", _ $intItemIndex = 0 $intControlID_From = BitAND($wParam, 0xFFFF) $intMessageCode = BitShift($wParam, 16) Switch $intControlID_From Case $IP Switch $intMessageCode Case $EN_CHANGE $strSearchString = GUICtrlRead($IP) $intItemIndex = _GUICtrlListBox_FindInText($Edit1, $strSearchString,-1) If @error Then ConsoleWrite("Error while searching the string in the ListBox. Error: " & @error & @CRLF) Else _GUICtrlListBox_SetCurSel($Edit1, $intItemIndex) If @error Then ConsoleWrite("Error while selecting the ListBox Item " & $intItemIndex & ".Error: " & @error & @CRLF) EndIf EndIf EndSwitch EndSwitch EndFunc