Jump to content

Recommended Posts

Posted (edited)

Rich-Edit Predict Text UDF

Working

It sub classes the rich-edit control and matches the current word through the Database

& sets selection in accordance.

For Edit Controls look

Functions

  • Predicts Text from an User-Defined Database.
  • Sets the Predicted Text when Enter is pressed.
  • Pressing Backspace deletes the previously typed character.
  • Support Editing, Overwriting, Updating, Deleting the Database.
  • Has the Feature to add New words the user types in the control, to the Database.
  • Supports Sensitive and In-Sensitive Prediction.
  • Currently Supports Auto-completion only.
  • Rich Edit Controls only supported
Future Updates
  • ​Support Auto-suggestion.
Note That if you set a Password Char for the Edit Box the Prediction will automatically get Unregistered.

This UDF requires Beta Release 3.3.9.4++ [beta-Oct-2012]

Index

; #CURRENT# =====================================================================================================================
;_RegisterPrediction
;_UpdatePredictList
;_UnRegisterPrediction
;_RegisterListingSpaceWords
;_RegisterListingNewWords
;_GetSelectedText
;_GetListCount
;_GetCurrentWord
;_GetCaretOffset
; ===============================================================================================================================

; #INTERNAL_USE_ONLY# ===========================================================================================================
;_New_WndProc
; AddToArray
; MakeArray
;_RichEdit_SubClass
;_AutoExit
;_PredictText
;_PredictSpaceText
;_SetSelection
;_MatchString
;_CtrlSetStyle
;_CtrlGetStyle
;_RemoveBit
; ===============================================================================================================================

Please Notify for any other Updates and Bugs. :graduated:

Change-log

v1.0 - First Release

v1.1 - Fixed a bug.

RichEditPredictText [uDF] v1.1

v1.1 RichEditPredictText UDF.7z

Previous Downloads : 80

Regards

Phoenix XL

Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Posted
  • 4 months later...
Posted

This UDF is great! It is so easy to use. Thank you for sharing. I am try to change one thing...after you press enter to accept the predicted text the cursor goes to the end of the the RichEdit control. Any idea how to make it go to the end of the predicted text instead?

Thanks.

Posted

The bug has been fixed. Check v1.1

Regards :)

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

  • 1 month later...
Posted (edited)

Odd, im on the current beta release and when using this outside of the examples instead of highlighting the suggestion and allowing you to hit enter to confirm, it automatically applies it.

And because i know someone will ask i did add #include-once

Edited by tonyatcodeleakers
Posted

Can you please post the script.

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Posted

I don't find any errors in the working of the UDF

#include-once
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIRichEdit.au3>
#include <GUIEdit.au3>
#include <GuiMenu.au3>
#include <GuiListBox.au3>
#include <Array.au3>
#include 'RichEditPredictText.au3'

Global $background, $fontsize, $fontname, $background2
Global $aMarquee[8]
Global $_Words2[3] = ['thread', 'level', 'self']
$sMsg = "This tool was coded and compiled" & @CRLF & @CRLF
$sMsg &= "By Tony@codeleakers" & @CRLF & "Version: 4.0"
$main = GUICreate("Tonys Script Editor", 800, 600, Default, Default, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_TABSTOP))
GUISetBkColor($background2)
$menu1 = GUICtrlCreateMenu("File")
$menu1item1 = GUICtrlCreateMenuItem("Save", $menu1)
$menu1item3 = GUICtrlCreateMenuItem("Open", $menu1)
$menu1item2 = GUICtrlCreateMenuItem("Exit", $menu1)
$menu2 = GUICtrlCreateMenu("Edit")
$menu2item1 = GUICtrlCreateMenuItem("Undo", $menu2)
$menu2item2 = GUICtrlCreateMenuItem("Redo", $menu2)
$menu2item3 = GUICtrlCreateMenuItem("Select All", $menu2)
$menu2item4 = GUICtrlCreateMenuItem("Copy", $menu2)
$menu2item5 = GUICtrlCreateMenuItem("Cut", $menu2)
$menu2item6 = GUICtrlCreateMenuItem("Paste", $menu2)
$menu3 = GUICtrlCreateMenu("Options")
$menu3item1 = GUICtrlCreateMenuItem("Settings", $menu3)
$ftp = GUICtrlCreateMenuItem("Check Syntax (GSC)", $menu3)
$ftp3 = GUICtrlCreateMenuItem("Upload to FTP", $menu3)
$menu4 = GUICtrlCreateMenu("Scripts")
$menu4item1 = GUICtrlCreateMenuItem("Dvar", $menu4)
$menu4item2 = GUICtrlCreateMenuItem("Give Weapon", $menu4)
$menu4item3 = GUICtrlCreateMenuItem("iprintBold", $menu4)
$menu4item4 = GUICtrlCreateMenuItem("Spawn Crate", $menu4)
$menu4item5 = GUICtrlCreateMenuItem("Spawn controllable Sentry", $menu4)
$edit = _GUICtrlRichEdit_Create($main, "", 5, 5, 790, 450, BitOR($ES_AUTOHSCROLL, $ES_AUTOVSCROLL, $WS_HSCROLL, $WS_VSCROLL, $ES_MULTILINE))
_WinAPI_SetFont($edit, _WinAPI_CreateFont(16, 0, 0, 0, 500, False, False, False, $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, "Courier New"))
_GUICtrlRichEdit_SetBkColor($edit, $background)
_RegisterPrediction($edit, $_Words2, Default, 0)

GUISetState()

While GUIGetMsg() <> -3
Sleep(10)
WEnd
_GUICtrlRichEdit_Destroy($edit)

The text is appended with selection and is deselected upon pressing ENTER.

P.S. You should post the problems in the topic itself so that anybody else facing the same problem can take help

Regards :)

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Posted

I don't find any errors in the working of the UDF

#include-once
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIRichEdit.au3>
#include <GUIEdit.au3>
#include <GuiMenu.au3>
#include <GuiListBox.au3>
#include <Array.au3>
#include 'RichEditPredictText.au3'

Global $background, $fontsize, $fontname, $background2
Global $aMarquee[8]
Global $_Words2[3] = ['thread', 'level', 'self']
$sMsg = "This tool was coded and compiled" & @CRLF & @CRLF
$sMsg &= "By Tony@codeleakers" & @CRLF & "Version: 4.0"
$main = GUICreate("Tonys Script Editor", 800, 600, Default, Default, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_TABSTOP))
GUISetBkColor($background2)
$menu1 = GUICtrlCreateMenu("File")
$menu1item1 = GUICtrlCreateMenuItem("Save", $menu1)
$menu1item3 = GUICtrlCreateMenuItem("Open", $menu1)
$menu1item2 = GUICtrlCreateMenuItem("Exit", $menu1)
$menu2 = GUICtrlCreateMenu("Edit")
$menu2item1 = GUICtrlCreateMenuItem("Undo", $menu2)
$menu2item2 = GUICtrlCreateMenuItem("Redo", $menu2)
$menu2item3 = GUICtrlCreateMenuItem("Select All", $menu2)
$menu2item4 = GUICtrlCreateMenuItem("Copy", $menu2)
$menu2item5 = GUICtrlCreateMenuItem("Cut", $menu2)
$menu2item6 = GUICtrlCreateMenuItem("Paste", $menu2)
$menu3 = GUICtrlCreateMenu("Options")
$menu3item1 = GUICtrlCreateMenuItem("Settings", $menu3)
$ftp = GUICtrlCreateMenuItem("Check Syntax (GSC)", $menu3)
$ftp3 = GUICtrlCreateMenuItem("Upload to FTP", $menu3)
$menu4 = GUICtrlCreateMenu("Scripts")
$menu4item1 = GUICtrlCreateMenuItem("Dvar", $menu4)
$menu4item2 = GUICtrlCreateMenuItem("Give Weapon", $menu4)
$menu4item3 = GUICtrlCreateMenuItem("iprintBold", $menu4)
$menu4item4 = GUICtrlCreateMenuItem("Spawn Crate", $menu4)
$menu4item5 = GUICtrlCreateMenuItem("Spawn controllable Sentry", $menu4)
$edit = _GUICtrlRichEdit_Create($main, "", 5, 5, 790, 450, BitOR($ES_AUTOHSCROLL, $ES_AUTOVSCROLL, $WS_HSCROLL, $WS_VSCROLL, $ES_MULTILINE))
_WinAPI_SetFont($edit, _WinAPI_CreateFont(16, 0, 0, 0, 500, False, False, False, $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, "Courier New"))
_GUICtrlRichEdit_SetBkColor($edit, $background)
_RegisterPrediction($edit, $_Words2, Default, 0)

GUISetState()

While GUIGetMsg() <> -3
Sleep(10)
WEnd
_GUICtrlRichEdit_Destroy($edit)

The text is appended with selection and is deselected upon pressing ENTER.

P.S. You should post the problems in the topic itself so that anybody else facing the same problem can take help

Regards :)

will do, and the issue is it doesn't highlight but instead automatically applies the text.
Posted

will do, and the issue is it doesn't highlight but instead automatically applies the text.

The text that is appended is selected so anything you type further will replace the appended text with the new one, that's how it works.

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

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
×
×
  • Create New...