The standard Edit control is a lightweight and surprisingly powerful window control for displaying and editing text. Inspired by the Edit mini-library created by Lexikos and the HiEditor library created by majkinetor, the Edit library was created to help exploit the capabilities of this excellent control.
Screenshots
A couple of screenshots from the examples...


The Code
The pertinent files are as follows:
- Project: Edit.zip (Includes the Edit library, add-on functions, and example scripts)
- Documentation: Edit Library
- AutoHotkey v1.1+ and Unicode. Starting with v1.2, the core library, i.e. Edit.ahk, should work with all versions of AutoHotkey, including AutoHotkey v1.1+ Unicode. However, some of the add-on functions, specifically the add-ons for Spell Check and Text-To-Speech, do present a challenge. The following items cover these issues.
- Spell Check. The Edit_SpellCheckGUI add-on uses the Spell library, the components of which (the Hunspell dynamic link library and the AutoHotkey wrapper) are not Unicode compatible. To use the Edit_SpellCheckGUI add-on, you must use AutoHotkey Basic or the ANSI version of AutoHotkey v1.1+.
- Text-To-Speech. The default text-to-speech add-on, Edit_TTSGUI, uses the COM library. This add-on will run on AutoHotkey Basic and the ANSI version of AutoHotkey v1.1+ but will not work on the Unicode version of AutoHotkey v1.1+.
A special version of the Text-To-Speech add-on as been written for AutoHotkey v1.1+. The function name is the same but the library file includes a "_L" at the end of the file name. The "_L" version of the add-on will run on both the ANSI and Unicode versions of AutoHotkey v1.1+.
The following posts were helpful in the creation of this library. Thanks to the original authors.
- Edit Control Functions
The original Edit library.
http://www.autohotke...trol-functions/
HiEdit Control
Syntax and some code ideas inspired by this library.
http://www.autohotke...-hiedit-4004-5/
- QuickBBCode
BBCode editor
http://www.autohotke...-bbcode-editor/
QuickEdit
Lightweight text editor
http://www.autohotke...ht-text-editor/
Controlling a ListView's Edit control
http://www.autohotke...e-2#entry558652
Increase the power of the standard InputBox dialog
http://www.autohotke...e-2#entry559990
No Dialog Find, Find Previous, Find Next, and Replace
http://www.autohotke...e-2#entry427084
Smart Word Wrap Toggle For Notepad
http://www.autohotke...ol/#entry338913
Validate As You Type
http://www.autohotke...e-2#entry432114
Release Notes
v0.1 (Preview)
Original release.
v0.2 (Preview)
- The Edit_CharFromPos function has been rewritten to support controls with more than 65,536 characters and/or more than 65,536 lines of text.
- Added Drag & Drop example (thanks Laszlo)
v1.0
- Removed Edit_GetThumb function. Could not get the EM_GETTHUMB message to work on an Edit control. Most documentation implies that the message is for the RichEdit control.
v1.1
- Fix: Edit_PosFromChar function modified to correctly return a negative number if the requested character is outside the edit control.
- Added the Edit_TTSGUI (Preview) add-on function to show a Text-To-Speech player for any edit control. Includes a plethora of options. Requires the COM library.
- Added the Edit_SpellCheckGUI (Preview) add-on function. Requires the Spell library.
- Updated examples.
v1.2
New Functions:
- Edit_ANSI2Unicode [Internal only] - Convert a character string (ANSI) to a UTF-16 (wide character) string.
- Edit_GetCueBanner - Gets the cue banner text for an edit control. [Windows Vista+]
- Edit_HideBalloonTip - Hide balloon tip associated with an edit control.
- Edit_SetCueBanner - Sets the cue banner text for an edit control [Windows XP+].
- Edit_ShowBalloonTip - Display a balloon tip associated with an edit control.
- Edit_Unicode2ANSI [Internal only] - Convert a UTF-16 (wide character) string to a character string (ANSI).
New Add-On Functions:
- Edit_TTSGUI for AutoHotkey v1.1+.
Updates/Enhancements:
- Several functions modified to support Unicode.
- Added new examples. Most of current example scripts have been rewritten or updated.
Bug Fix:
- Edit_GetLimitText - Function was converting return value from UInt (32-bit unsigned integer) to Int (32-bit signed integer) which incorrectly converted values over 2,147,483,647 into negative values. This change may affect the way your script tested for maximum values. See the function documentation or the correct maximum values to test for.
v1.3
New Functions:
- Edit_ActivateParent - Activate (make foremost) the parent window of the Edit control.
- Edit_Disable - Disable the Edit control.
- Edit_DisableAllScrollBars - Disable all scroll bars.
- Edit_DisableHScrollBar - Disable the horizontal scroll bar.
- Edit_DisableVScrollBar - Disable the vertical scroll bar.
- Edit_Enable - Enable the Edit control.
- Edit_EnableAllScrollBars - Enable all scroll bars.
- Edit_EnableHScrollBar - Enable the horizontal scroll bar.
- Edit_EnableVScrollBar - Enable the vertical scroll bar.
- Edit_EnableScrollBar - Enable the specified scroll bar.
- Edit_GetComboBoxEdit - Get the handle of the Edit control attached to a combo box. (thanks just me)
- Edit_GetFont - Get the font of the Edit control.
- Edit_GetParent - Get the handle to the Edit control's parent window.
- Edit_GetPos - Get the position and size of the Edit control.
- Edit_GetScrollBarInfo [Internal only] - Get the information for a scroll bar.
- Edit_GetStyle - Get the styles currently set for the Edit control.
- Edit_HasFocus - Determine if an Edit control has input focus.
- Edit_Hide - Hide an Edit control.
- Edit_HideAllScrollBars - Hide all scroll bars.
- Edit_HideHScrollBar - Hide the horizontal scroll bar.
- Edit_HideVScrollBar - Hide the vertical scroll bar.
- Edit_IsDisabled - Determine if the Edit control is disabled.
- Edit_IsHScrollBarEnabled - Determine if the horizontal scroll bar is enabled.
- Edit_IsHScrollBarVisible - Determine if the horizontal scroll bar is visible.
- Edit_IsVScrollBarEnabled - Determine if the vertical scroll bar is enabled.
- Edit_IsVScrollBarVisible - Determine if the vertical scroll bar is visible.
- Edit_ScrollPage - Scrolls the Edit control by page.
- Edit_SetFocus - Set input focus to the Edit control.
- Edit_SetFont - Set the font of the Edit control.
- Edit_Show - Show the Edit control.
- Edit_ShowAllScrollBars - Show all scroll bars.
- Edit_ShowHScrollBar - Show the horizontal scroll bar.
- Edit_ShowScrollBar - Show the specified scroll bar.
- Edit_ShowVScrollBar - Show the vertical scroll bar.
Updates/Enhancements:
- Added p_SetModify parameter to the Edit_SetText function. If set to TRUE, the modification flag on the Edit control is set after the text is set.
- Edit_LineScroll function modified to support new options: Top, Bottom, Left, and Right.
- Added 6 new examples.




