program builder Posted November 19, 2009 Posted November 19, 2009 (edited) Is it possible, to make available text choises apear as you type them into an input box, then choose it, before everything is typed out, kinda like google does. like lets say if you build it to where if you type hello how are you doing today it will say back to you i am doing ok. how about yourself? I want to make a chatbot, so when the people start to type out what they want to say to it, or ask it, they can click on the words as they come up, and pick what comes the clossest to what they want to say. is their anyway to do this, inside an inputbox? please help if you can. Edited November 19, 2009 by program builder
Authenticity Posted November 19, 2009 Posted November 19, 2009 Kinda what Google does but you need to tweak the used data base, here it's the dll's of System32 folder: expandcollapse popup#include <Array.au3> #include <File.au3> #include <GUIComboBox.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> ;~ #include <Constants.au3> Local $avItems = _FileListToArray(@SystemDir, "*.dll", 1), $sItems = _ArrayToString($avItems) Local $hGUI = GUICreate("Title", 300, 300) Local $Combo = GUICtrlCreateCombo("", 50, 20), $hCombo = GUICtrlGetHandle($Combo) GUICtrlSetData($Combo, StringTrimLeft($sItems, StringInStr($sItems, '|'))) GUISetState() GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() Exit Func _WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) Local $hWndFrom, $iCode Local $sText, $sItems $hWndFrom = $ilParam $iCode = BitShift($iwParam, 16) If $hWndFrom = $hCombo Then If $iCode = $CBN_EDITCHANGE Then $sText = GUICtrlRead($Combo, 1) If $sText <> "" Then If IsArray($avItems) Then _GUICtrlComboBox_BeginUpdate($hCombo) For $i = 1 To _GUICtrlComboBox_GetCount($hCombo) _GUICtrlComboBox_DeleteString($hCombo, 0) Next For $i = 1 To $avItems[0] If StringRegExp($avItems[$i], "(?i)^\Q" & $sText & "\E") Then $sItems &= $avItems[$i] & "|" Next GUICtrlSetData($Combo, StringTrimRight($sItems, 1)) _GUICtrlComboBox_EndUpdate($hCombo) _GUICtrlComboBox_ShowDropDown($hCombo, True) EndIf Else If IsArray($avItems) Then GUICtrlSetData($Combo, "") For $i = 1 To $avItems[0] $sItems &= $avItems[$i] & "|" Next GUICtrlSetData($Combo, StringTrimRight($sItems, 1)) EndIf EndIf EndIf EndIf Return $GUI_RUNDEFMSG EndFunc
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