Skip to content

Commit

Permalink
*2.20.0 4/7/2015
Browse files Browse the repository at this point in the history
** Added a Settings window (thanks to HugoV for doing much of the coding).
** Changed the learned words to use an SQLite3 database backend. This should help with future enhancements
** Changing settings no longer requires a script restart
** Added Active/Inactive Notification Area icons
** Added working Pause functionality
** Detecting Window switches now uses Windows Event Hooks, rather than a timer
** Added weighting based on number of characters left to type
** Changed license to GPLv3 for compatibility with AhkDBA SQLite3 interface
** Added the ability to learn words with no alpha characters when hitting Ctrl-Shift-C, or to read them in from Wordlist.txt
** Fixed Wordlist drawing on the mouse when unable to detect the caret position
** Fixed words not being learned when hitting Ctrl-Shift-C while Learning is off
** Large amounts of code refactoring, including renaming all global variables and fixing function scope
** Fixed having length of 1 not work with ForceNewWordCharacters

* remotes/origin/SQLite: (62 commits)
  Fixed 2.20.0 date
  Fixed typo in Changelog
  Fixed a bug where the first letter typed would be missed in new documents in some programs
  Final (hopefully) commit before merging to master Previously LearnedWords now appear when Learning is turned off Ctrl-Shift-C learns words again when Learning is turned off
  Added a duplicate check when adding new Program Titles/Executables via the UI buttons. Fixed some help text
  Fixed icon paths to be absolute paths
  Prevent creation of 0 byte preferences file
  Rewrote help to reference the new Settings screen fixed a typo in a Setting title
  Added check to prevent attempting to launch the Settings window again if already in the Settings window.
  Fixed Programs page not populating Edit Button screen. Fixed edit boxes expanding to more than 1 line when reloading the GUI
  Fixed hotkeys suspending the settings Window Added a warning when Canceling the settings window when unsaved changes exist
  Fixed Visit Forum link not highlighting (really this time)
  Fixed a bug where the WinEventHook was launching new threads while in the Settings window
  Added support for AHK 1.1.20.00 returning nil in A_CaretX/Y when it can't detect the caret position.
  updated sqlite3 to 3.8.8.3 (cyqlite version) from an old version of 3.7.
  Changed Pause button to use a checkmark rather than toggling between Pause/Resume to follow Windows Notification Area guidelines.
  Added Exit button in a compiled script
  Fixed toggling number keys on/off
  Updated with latest changes to DBA
  Renamed ALL global variables
  ...
  • Loading branch information
ManiacDC committed Apr 9, 2015
2 parents 703ae70 + ed91cbe commit 95f827d
Show file tree
Hide file tree
Showing 37 changed files with 7,181 additions and 1,794 deletions.
15 changes: 15 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
*2.20.0 4/9/2015
** Added a Settings window (thanks to HugoV for doing much of the coding).
** Changed the learned words to use an SQLite3 database backend. This should help with future enhancements
** Changing settings no longer requires a script restart
** Added Active/Inactive Notification Area icons
** Added working Pause functionality
** Detecting Window switches now uses Windows Event Hooks, rather than a timer
** Added weighting based on number of characters left to type
** Changed license to GPLv3 for compatibility with AhkDBA SQLite3 interface
** Added the ability to learn words with no alpha characters when hitting Ctrl-Shift-C, or to read them in from Wordlist.txt
** Fixed Wordlist drawing on the mouse when unable to detect the caret position
** Fixed words not being learned when hitting Ctrl-Shift-C while Learning is off
** Large amounts of code refactoring, including renaming all global variables and fixing function scope
** Fixed having length of 1 not work with ForceNewWordCharacters

*2.19.9 12/18/2014
** Fixed bug when creating TerminatingCharacters when generating preferences file. Broken TerminatingCharacters will be repaired if not already modified.
** Added "Threading" during the input loop to cause less missed keys
Expand Down
15 changes: 15 additions & 0 deletions DBA license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
AHK DBA - OOP Database Access Framework
Copyright (C) 2012 IsNull and other contributors

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Binary file added Images/TypingAidSettings.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/typewriter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
904 changes: 619 additions & 285 deletions LICENSE

Large diffs are not rendered by default.

58 changes: 30 additions & 28 deletions Readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ TypingAid is a simple, compact, and handy auto-completion utility.
It is customizable enough to be useful for regular typing and for programming.

[b]Download:[/b]
[url=https://github.com/ManiacDC/TypingAid/releases/download/v2.19.9/TypingAid.exe]TypingAid v2.19.9 Precompiled Executable[/url]
[url=https://github.com/ManiacDC/TypingAid/releases/download/v2.19.9/TypingAid64.exe]TypingAid v2.19.9 64-bit Precompiled Executable[/url]
[url=https://github.com/ManiacDC/TypingAid/archive/v2.19.9.zip]TypingAid v2.19.9 AHK Script[/url]
[url=https://github.com/ManiacDC/TypingAid/releases/download/v2.20.0/TypingAid.zip]TypingAid v2.20.0 Precompiled Executable[/url]
[url=https://github.com/ManiacDC/TypingAid/archive/v2.20.0.zip]TypingAid v2.20.0 AHK Script[/url]

As of version 2.19.7.0, the script is no longer compatible with AHK Basic. Please get the newest version from [url]http://www.ahkscript.org[/url].

Expand All @@ -24,52 +23,53 @@ AHK Keyword Wordlist:

[b]Screenshots:[/b]
[img]https://github.com/ManiacDC/TypingAid/raw/master/Images/TypingAidListBox.png[/img]
[img]https://github.com/ManiacDC/TypingAid/raw/master/Images/TypingAidSettings.png[/img]

[b][url=https://github.com/ManiacDC/TypingAid/raw/master/Changelog.txt]Change Log[/url][/b]

[b]Features:[/b]
As you type your word, up to 10 (or as defined in the Preferences file) matches will appear in a drop-down dialog, numbered 1 - 0 (10th). To choose the match you want just hit the associated number on your keyboard (numpad does not work). Alternatively you can select an item from the drop-down using the Up/Down arrows. You can define a fixed position for the drop-down dialog to appear by hitting Ctrl-Shift-H to open a small helper window, or by specifying a list of programs in the preferences file. Please note that in Firefox, Thunderbird, and certain other programs you will probably need to open the helper window due to issues detecting the caret position.
As you type your word, up to 10 (or as defined in Settings) matches will appear in a drop-down dialog, numbered 1 - 0 (10th). To choose the match you want just hit the associated number on your keyboard (numpad does not work). Alternatively you can select an item from the drop-down using the Up/Down arrows. You can define a fixed position for the drop-down dialog to appear by hitting Ctrl-Shift-H to open a small helper window, or by specifying a list of programs in the preferences file. Please note that in Firefox, Thunderbird, and certain other programs you will probably need to open the helper window due to issues detecting the caret position.

Words should be stored in a file named 'Wordlist.txt' which should be located in the script directory. These words may be commented out by prefixing with a semicolon or simply removed or added. Words may include terminating characters (such as space), but you must select the word before typing the terminating character.

In addition to being able to use the number keys to select a word, you can select words from the drop-down via the Up/Down arrows. Hitting Up on the first item will bring you to the last and hitting Down on the last item will bring you to the first. Hitting Page Up will bring you up 10 items, or to the first item. Hitting Page Down will bring you down 10 items, or to the last item. You can hit Tab, Right Arrow, Ctrl-Space, or Ctrl-Enter to autocomplete the selected word. This feature can be disabled or have some of its behavior modified via the Preferences file.
In addition to being able to use the number keys to select a word, you can select words from the drop-down via the Up/Down arrows. Hitting Up on the first item will bring you to the last and hitting Down on the last item will bring you to the first. Hitting Page Up will bring you up 10 items, or to the first item. Hitting Page Down will bring you down 10 items, or to the last item. You can hit Tab, Right Arrow, Ctrl-Space, or Ctrl-Enter to autocomplete the selected word. This feature can be disabled or have some of its behavior modified via Settings.

The script will learn words as you type them if LearnMode=On in the preferences file. If you type a word more than 5 times (or as defined in the preferences.ini file) in a single session the word will be added to a WordlistLearned.txt file. Learned words are stored in the WordlistLearned.txt file. Learned words will always appear below predefined words, but will be ranked and ordered among other learned words based on the frequency you type them. You can permanently learn a word by highlighting a word and hitting Ctrl-Shift-C (this works even if LearnMode=Off). You may use Ctrl-Shift-Del to remove the currently selected Learned Word, or you may manually remove them while the script is off.
When LearnMode=On, entries in the wordlist file and learned words are limited to a length of 123 (or 61 when using Unicode AHK) characters due to internal workings.
The script will learn words as you type them if "Learn new words as you type" is set to On in Settings. If you type a word more than 5 times (or as defined in "Minimum length of word to learn") in a single session the word will be permanently added to the list of learned words. Learned words will always appear below predefined words, but will be ranked and ordered among other learned words based on the frequency you type them. You can permanently learn a word by highlighting a word and hitting Ctrl-Shift-C (this works even if "Learn new words as you type" is set to Off). You may use Ctrl-Shift-Del to remove the currently selected Learned Word.
Learned words are stored in the WordlistLearned.db sqlite3 database. Learned words are backed up in WordlistLearned.txt. To modify the list of Learned words manually, delete the WordlistLearned.db database, then manually edit the WordlistLearned.txt file. On the next launch of the script, the WordlistLearned.db database will be rebuilt.

The script will automatically create a file named preferences.ini in the script directory. This file allows for customization of the script.
To allow for distribution of standardized preferences, a Defaults.ini may be distributed with the same format as Preferences.ini. If the Defaults.ini is present, Preferences.ini will not be created. A user may override the Defaults.ini by manually creating a Preferences.ini.
When Settings are changed, the script will automatically create a file named Preferences.ini in the script directory. This file allows for sharing settings between users. Users are encouraged to only edit settings by using the Settings window.
To allow for distribution of standardized preferences, a Defaults.ini may be distributed with the same format as Preferences.ini. If the Defaults.ini is present, this will override the hardcoded defaults in the script. A user may override the Defaults.ini by changing settings in the Settings window.

Customizable features include:
[LIST]
[*]List of programs for which you want TypingAid enabled.[/*]
[*]List of programs for which you do not want TypingAid enabled.[/*]
[*]Number of characters before the list of words appears.[/*]
[*]Number of times you must press a number hotkey to select the associated word (options are 1 and 2, 2 has had minimal testing).[/*]
[*]Enable or disable learning mode.[/*]
[*]Number of times you must type a word before it is permanently learned.[/*]
[*]Number of characters a word needs to have in order to be learned.[/*]
[*]List of strings which will prevent any word which contains one of these strings from being learned.[/*]
[*]Number of times you must type a word before it is permanently learned.[/*]
[*]Number of items to show in the list at once.[/*]
[*]Number of characters before the list of words appears.[/*]
[*]Change the method used to send the word to the screen.[/*]
[*]Enable, disable, or customize the arrow key's functionality.[/*]
[*]Disable certain keys for autocompleting a word selected via the arrow keys.[/*]
[*]Enable or disable the resetting of the List Box on a mouseclick.[/*]
[*]Change whether the script simply completes or actually replaces the word (capitalization change based on the wordlist file)[/*]
[*]Change whether the script simply completes or actually replaces the word (capitalization change based on the wordlist file).[/*]
[*]Enable or disable the resetting of the Wordlist Box on a mouseclick.[/*]
[*]Change whether a space should be automatically added after the autocompleted word or not.[/*]
[*]List of strings which will prevent any word which contains one of these strings from being learned.[/*]
[*]Change whether the typed word should appear in the word list or not.[/*]
[*]Change the method used to send the word to the screen.[/*]
[*]Number of pixels below the caret to display the Wordlist Box.[/*]
[*]Wordlist Box Default Font of fixed (Courier New) or variable (Tahoma) width.[/*]
[*]Wordlist Box Font Size.[/*]
[*]Wordlist Box Opacity setting to set the transparency of the List Box.[/*]
[*]Wordlist Box Character Width to override the computed character width.[/*]
[*]Wordlist Box Default Font override.[/*]
[*]List of programs for which you want %g_ScriptTitle% enabled.[/*]
[*]List of programs for which you do not want %g_ScriptTitle% enabled.[/*]
[*]List of programs for which you want the Helper Window to automatically open.[/*]
[*]List of characters which terminate a word.[/*]
[*]List of characters which terminate a word and start a new word.[/*]
[*]List of programs for which you want the Helper Window to automatically open.[/*]
[*]Number of pixels below the caret to display the List Box.[/*]
[*]List Box Default Font of fixed (Courier New) or variable (Tahoma) width.[/*]
[*]List Box Default Font override.[/*]
[*]List Box Font Size.[/*]
[*]List Box Character Width to override the computed character width.[/*]
[*]List Box Opacity setting to set the transparency of the List Box.[/*]
[*]List Box Rows to define the number of items to show in the list at once.[/*]
[*]Number of times you must press a number hotkey to select the associated word (options are 1 and 2, 2 is buggy).[/*]
[/LIST]
[b]Unicode Support:[/b]
Full (untested) for UTF-8 character set.
Full support for UTF-8 character set.

[b][url=https://github.com/ManiacDC/TypingAid/issues?q=is%3Aopen+is%3Aissue]Known Issues[/url][/b]

Expand All @@ -78,11 +78,13 @@ Full (untested) for UTF-8 character set.
[b][url=https://github.com/ManiacDC/TypingAid/issues?q=is%3Aopen+is%3Aissue+label%3Aenhancement]Future Features[/url][/b]

[b]Credits:[/b]
Jordi S
Maniac
Jordi S
HugoV
kakarukeys
Asaptrad
j4hangir
Theclaw


[b][url=http://www.autohotkey.com/board/topic/636-intellisense-like-autoreplacement-with-multiple-suggestions/]Original Thread[/url][/b]
122 changes: 55 additions & 67 deletions Source/Includes/Helper.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
MaybeOpenOrCloseHelperWindow(ActiveProcess,ActiveTitle,ActiveId)
{
; This is called when switching the active window
global HelperManual
global g_HelperManual

IfNotEqual, HelperManual,
IfNotEqual, g_HelperManual,
{
MaybeCreateHelperWindow()
Return
}

IF ( CheckHelperWindowAuto(ActiveProcess,ActiveTitle) )
{
global HelperClosedWindowIds
global g_HelperClosedWindowIds
; Remove windows which were closed
Loop, Parse, HelperClosedWindowIDs, |
Loop, Parse, g_HelperClosedWindowIDs, |
{
IfEqual, A_LoopField,
Continue
Expand All @@ -26,12 +26,12 @@ MaybeOpenOrCloseHelperWindow(ActiveProcess,ActiveTitle,ActiveId)
}
}

HelperClosedWindowIDs = %TempHelperClosedWindowIDs%
g_HelperClosedWindowIDs = %TempHelperClosedWindowIDs%
TempHelperClosedWindowIDs =

SearchText := "|" . ActiveId . "|"

IfInString, HelperClosedWindowIDs, %SearchText%
IfInString, g_HelperClosedWindowIDs, %SearchText%
{
MaybeSaveHelperWindowPos()
} else MaybeCreateHelperWindow()
Expand All @@ -44,16 +44,16 @@ MaybeOpenOrCloseHelperWindow(ActiveProcess,ActiveTitle,ActiveId)

CheckHelperWindowAuto(ActiveProcess,ActiveTitle)
{
global HelperWindowProgramExecutables
global HelperWindowProgramTitles
global prefs_HelperWindowProgramExecutables
global prefs_HelperWindowProgramTitles

Loop, Parse, HelperWindowProgramExecutables, |
Loop, Parse, prefs_HelperWindowProgramExecutables, |
{
IfEqual, ActiveProcess, %A_LoopField%
Return, true
}

Loop, Parse, HelperWindowProgramTitles, |
Loop, Parse, prefs_HelperWindowProgramTitles, |
{
IfInString, ActiveTitle, %A_LoopField%
Return, true
Expand All @@ -65,36 +65,32 @@ CheckHelperWindowAuto(ActiveProcess,ActiveTitle)
MaybeOpenOrCloseHelperWindowManual()
{
;Called when we hit Ctrl-Shift-H

;make sure we are in decimal format in case ConvertWordToAscii was interrupted
IfEqual, A_FormatInteger, H
SetFormat,Integer,D

global Helper_id
global HelperManual
global g_Helper_Id
global g_HelperManual

;If a helper window already exists
IfNotEqual, Helper_id,
IfNotEqual, g_Helper_Id,
{
; If we've forced a manual helper open, close it. Else mark it as forced open manually
IfNotEqual, HelperManual,
IfNotEqual, g_HelperManual,
{
HelperWindowClosed()
} else HelperManual=1
} else g_HelperManual=1
} else {
global Active_id
WinGetTitle, ActiveTitle, ahk_id %Active_id%
WinGet, ActiveProcess, ProcessName, ahk_id %Active_id%
global g_Active_Id
WinGetTitle, ActiveTitle, ahk_id %g_Active_Id%
WinGet, ActiveProcess, ProcessName, ahk_id %g_Active_Id%
;Check for Auto Helper, and if Auto clear closed flag and open
IF ( CheckHelperWindowAuto(ActiveProcess,ActiveTitle) )
{
global HelperClosedWindowIDs
SearchText := "|" . Active_id . "|"
StringReplace, HelperClosedWindowIDs, HelperClosedWindowIDs, %SearchText%
global g_HelperClosedWindowIDs
SearchText := "|" . g_Active_Id . "|"
StringReplace, g_HelperClosedWindowIDs, g_HelperClosedWindowIDs, %SearchText%

} else {
; else Open a manually opened helper window
HelperManual=1
g_HelperManual=1
}
MaybeCreateHelperWindow()
}
Expand All @@ -107,28 +103,24 @@ MaybeOpenOrCloseHelperWindowManual()
;Create helper window for showing ListBox
MaybeCreateHelperWindow()
{
Global Helper_id
global HelperGui
Global g_Helper_Id
Global g_XY
;Don't open a new Helper Window if One is already open
IfNotEqual, Helper_id,
IfNotEqual, g_Helper_Id,
Return

;make sure we are in decimal format in case ConvertWordToAscii was interrupted
IfEqual, A_FormatInteger, H
SetFormat,Integer,D
Global XY
Gui, %HelperGui%:+Owner -MinimizeBox -MaximizeBox +AlwaysOnTop
Gui, %HelperGui%:+LabelHelper_
Gui, %HelperGui%:Add, Text,,List appears here
IfNotEqual, XY,
Gui, HelperGui:+Owner -MinimizeBox -MaximizeBox +AlwaysOnTop
Gui, HelperGui:+LabelHelper_
Gui, HelperGui:Add, Text,,List appears here
IfNotEqual, g_XY,
{
StringSplit, Pos, XY, `,
Gui, %HelperGui%:Show, X%Pos1% Y%Pos2% NoActivate
StringSplit, Pos, g_XY, `,
Gui, HelperGui:Show, X%Pos1% Y%Pos2% NoActivate
} else {
Gui, %HelperGui%:Show, NoActivate
Gui, HelperGui:Show, NoActivate
}
WinGet, Helper_id, ID,,List appears here
WinSet, Transparent, 125, ahk_id %Helper_id%
WinGet, g_Helper_Id, ID,,List appears here
WinSet, Transparent, 125, ahk_id %g_Helper_Id%
return
}

Expand All @@ -140,28 +132,25 @@ Return

HelperWindowClosed()
{
;make sure we are in decimal format in case ConvertWordToAscii was interrupted
IfEqual, A_FormatInteger, H
SetFormat,Integer,D
global Helper_id
global HelperManual
IfNotEqual, Helper_id,
global g_Helper_Id
global g_HelperManual
IfNotEqual, g_Helper_Id,
{
;Check LastActiveIdBeforeHelper and not Active_id in case we are on the Helper Window
global LastActiveIdBeforeHelper
WinGetTitle, ActiveTitle, ahk_id %LastActiveIdBeforeHelper%
WinGet, ActiveProcess, ProcessName, ahk_id %LastActiveIdBeforeHelper%
;Check g_LastActiveIdBeforeHelper and not g_Active_Id in case we are on the Helper Window
global g_LastActiveIdBeforeHelper
WinGetTitle, ActiveTitle, ahk_id %g_LastActiveIdBeforeHelper%
WinGet, ActiveProcess, ProcessName, ahk_id %g_LastActiveIdBeforeHelper%

If ( CheckHelperWindowAuto(ActiveProcess,ActiveTitle) )
{
global HelperClosedWindowIDs
global g_HelperClosedWindowIDs

SearchText := "|" . LastActiveIdBeforeHelper . "|"
IfNotInString HelperClosedWindowIDs, %SearchText%
HelperClosedWindowIDs .= SearchText
SearchText := "|" . g_LastActiveIdBeforeHelper . "|"
IfNotInString g_HelperClosedWindowIDs, %SearchText%
g_HelperClosedWindowIDs .= SearchText
}

HelperManual=
g_HelperManual=

MaybeSaveHelperWindowPos()
}
Expand All @@ -172,17 +161,16 @@ HelperWindowClosed()

MaybeSaveHelperWindowPos()
{
global Helper_id
global HelperGui
IfNotEqual, Helper_id,
global g_Helper_Id
IfNotEqual, g_Helper_Id,
{
global XY
global XYSaved
WinGetPos, hX, hY, , , ahk_id %Helper_id%
XY = %hX%`,%hY%
XYSaved = 1
Helper_id =
Gui, %HelperGui%:Hide
global g_XY
global g_XYSaved
WinGetPos, hX, hY, , , ahk_id %g_Helper_Id%
g_XY = %hX%`,%hY%
g_XYSaved = 1
g_Helper_Id =
Gui, HelperGui:Hide
}
Return
}
Expand Down
Loading

0 comments on commit 95f827d

Please sign in to comment.