Jump to content
Sign in to follow this  
program builder

text appears as you type into a message box

Recommended Posts

program builder

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 by program builder

Share this post


Link to post
Share on other sites
Authenticity

Kinda what Google does but you need to tweak the used data base, here it's the dll's of System32 folder:

#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

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.