Jump to content
Sign in to follow this  
PhoenixXL

Predict Text for a RichEdit Control _RichEditPredictText.au3 (UDF)

Recommended Posts

PhoenixXL

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.

Share this post


Link to post
Share on other sites
Danyfirex

thank you for updating. it's very usefull. I'll try out. regards

Share this post


Link to post
Share on other sites
initspawn

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.

Share this post


Link to post
Share on other sites
PhoenixXL

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.

Share this post


Link to post
Share on other sites
tonyatcodeleakers

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

Share this post


Link to post
Share on other sites
PhoenixXL

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.

Share this post


Link to post
Share on other sites
tonyatcodeleakers

Can you please post the script.

IL pm you the source.

Share this post


Link to post
Share on other sites
PhoenixXL

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.

Share this post


Link to post
Share on other sites
tonyatcodeleakers

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.

Share this post


Link to post
Share on other sites
PhoenixXL

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.

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  

  • Similar Content

    • MFrancisca
      By MFrancisca
      Hello! 
      I've been checking the logging UDFs in the wiki, mostly Log4a and Loga and I wanted to ask which one would you recommend for a script that will be executed remotely through PSExec. My main question is where the logs are located in that situation and if I can change that location to a custom one., because I need to retrieve them at the end of execution.
      So in a rough description the process is
      Open PSExec
      Send compiled AutoIT script to remote machine
      Execute script
      Copy logs from the remote to the local machine.
       
      Any opinions? 
    • Epic007
      By Epic007
      Hey guys I'm stuck with a program.....I need a make an automation which copies text from a chat bot app and paste it in notepad to log the replies of my chat bot and to analyse stuff....a lil help pls
       
       
       
       
       
       
       
      Thanks in advance
    • nooneclose
      By nooneclose
      I need to send a string of text to this popup and click on the ok button to save it.
      Here is the code I have so far:
      ;Start IE Sleep(7000) $oIE = _IECreate("http://www.google.com") Sleep(500) _IELoadWait($oIE) $hIE = _IEPropertyGet($oIE, "hwnd") ; Get Handle of the IE window Sleep(500) WinSetState($hIE, "", @SW_MAXIMIZE) ;Wait for a browser page load to complete Sleep(3000) _IENavigate($oIE, "https://properURL.com") Sleep(8000) _IELoadWait($oIE) ;Attach to a browser control embedded in another window $oIE = _IEAttach("https://"properURL.com", url") ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $oIE = ' & $oIE & @CRLF & '>Error code: ' & @error & ' Extended code: 0x' & Hex(@extended) & @CRLF) ;### Debug Console Sleep(2000) ;Get the title of the webpage ;Local $wTitle = _IEPropertyGet($oIE, "title") ;MsgBox($MB_SYSTEMMODAL, "Webpage title:", $wTitle) ;Clicks the new button Sleep(3000) _IEAction($nWorkOrderB, "focus") _IEAction($nWorkOrderB, "click") Sleep(5000) ;Store the Element names where the important data will be sent ;Store the long description button Local $wLongDButton = _IEGetObjById($oIE, "m65d795a4-img") ;Store the long Description field id Local $wComments = _IEGetObjById($oIE, "ma6499a9c-rte_iframe") ;Store the ok button id that is in the long description Local $wCommOk = _IEGetObjById($oIE, "m74031266-pb") ;******************************************************************************* ; Send the stored data to the proper field ;******************************************************************************* ;Click the long description button Sleep(300) _IEAction($wLongDButton, "focus") _IEAction($wLongDButton, "click") Sleep(300) ;Sends the Comments Sleep(500) _IEAction($wComments, "focus") _IEAction($wComments, "click") Sleep(500) _IEFormElementSetValue($wComments, "hello darkness my old friend") ;Click the ok button Sleep(500) _IEAction($wCommOk, "focus") _IEAction($wCommOk, "click") Sleep(500)  
      Here is the popup:

    • reida
      By reida
      Hello. Help to write the text.
      <textarea tabindex="4" class="js-input compose__labels__input" style="width: 407px; max-width: 413px;" wrap="off" autocomplete="off" data-original-name="To"></textarea>  I can not make.
      #include <IE.au3> $sLogin = 'adv' $iError = 1 $sUrl = 'https://......' $oIE = _IECreate($sUrl) ;;; _IELoadWait($oIE) $oLogin = _IEGetObjByName($oIE, "To") Sleep(7000) If IsObj($oLogin) Then _IEFormElementSetValue($oLogin, $sLogin) _IELoadWait($oIE) ; EndIf EndIf Through the selector it can be possible?
      #toolkit-154163367424641composeForm > div:nth-child(1) > div > div.compose-head__content.js-collapsed-off > div.compose-head__row-wrapper.compose-head__row-wrapper_to.js-row > div > div > div:nth-child(2) > div > div > div > textarea.js-input.compose__labels__input  
    • nooneclose
      By nooneclose
      I am sure you guys know of a simple solution but I am still kind of new to AutoIt and its special functions. I want my code to be able to know how to encrypt and decrypt "A" and "a" as two different chars.
      my code is very long so here is just a snippet/example of it.  
      ;Encode== Global $charAA = "" ; ( Capital letter A ) = Global 184 = ¸ ( Cedilla ) $charAA = $charAA & Chr(65) Global $chara = "" ; ( Lowercase letter a ) = Global 251 = û ( û Latin Small Letter U With Circumflex ) $chara = $chara & Chr(97) ;Decode== Global $ch184 = "" ;( Copyright symbol ) = $charAA $ch184 = $ch184 & Chr(184) Global $ch251 = "" ;( û Latin Small Letter U With Circumflex ) = $chara $ch251 = $ch251 & Chr(251) ;Encode== stringreplace($test_String, $charAA, $ch184) stringreplace($test_String, $chara, $ch251) ;Decode== stringreplace($$new_String, $ch184, $charAA) stringreplace($$new_String, $ch251, $chara) ( NOTE: my stringreplace function is nested in my actual code. I only separated them here for readability. )

      I know there are better ways to Encrypt and Decrypt a message but I'm doing this as a fun side project for me and a select group of friends to enjoy. 
      Again My code is not encrypting or decrypting capitals and lower case properly even though I use their ANSI codes. 
       
      Example: Input "A a B b"  Encrypt: ". . $ $"  Decrypt: "A A B B"
      Any and all help will be greatly appreciated.  
×