Jump to content


Photo

TypingAid v2.18 - Word AutoCompletion Utility

ahk-1.0 ahk-1.1 scripts

  • Please log in to reply
586 replies to this topic

#1 maniac

maniac
  • Members
  • 311 posts

Posted 22 January 2010 - 02:17 PM

TypingAid is a simple, compact, and handy auto-completion utility.

It is customizable enough to be useful for regular typing and for programming.

Download:
TypingAid v2.18

ArtWinAuto.com page (Link Broken. with compiled executables and alternative download links, may not be as up-to-date as this thread).

ArtWinAuto will eventually be hosting some customized preferences.ini files which with out-of-the-box support for many languages besides english.

Collection of WordLists (Link Broken)

English Wordlists:
1200 English Words Weighted By Frequency
2000 Common English Words
2000 Common English Words (Alternative)
3600 English Words
Large English Wordlist (Unfiltered, may contain curse words, etc)

AHK Keyword Wordlist:
http://www.autohotke...it/WordList.txt (Thanks tidbit.)

Screenshots:
TypingAidListBox.png

Change Log

Features:
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.

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.

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 the wordlist.txt file. Learned words are stored below the predefined words in the wordlist under a keyword called ;LEARNEDWORDS;. 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). If you want to remove any learned words from your list you must manually remove them.
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 automatically create a file named preferences.ini in the script directory. This file allows for customization of the script.
Customizable features include:
  • 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.
  • 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 a space should be automatically added after the autocompleted word or not.
  • Change the method used to send the word to the screen.
  • 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.
Unicode Support:
Full (untested) for UTF-8 character set.
AHK_L is required.

Known Issues:
  • Some computers have had issues with SendMethod=1 not sending any characters. Try a different SendMethod if you have problems.
  • The caret position cannot be detected in certain applications, such as FireFox, OpenOffice.org, and Thunderbird. As a workaround for this the drop-down will open at the last position you clicked with your mouse, or you can open a helper window by hitting Ctrl-Shift-H.
  • There are problems correctly handling dead keys like `" in certain keyboard layouts where they are used to type accented characters.
  • Similar to the above, Chinese/Japanese IME (and any other languages which operate by changing characters) input will have issues.
  • Occasionally the program might fail to delete one or two characters during autocompletion. There are 2 reasons for this - A. It is possible to type fast enough that the script misses keys. B. I have noticed that sometimes the script attempts to send the right number of backspaces, but the active window doesn't receive all of them. Changing the SendMethod in the Preferences.ini file may address this.
  • SendMethod=1 is unable to send characters which do not exist on your keyboard layout. Try switching to a different SendMethod in the Preferences.ini file if you find that you are unable to autocomplete certain characters.
  • With CAPS lock on, if you hit the Up/Down arrow to change lines and begin typing, the first character you type will not be capitalized on some machines.
  • If using an On-Screen Keyboard, please disable DetectMouseClickMove or the word will be reset while typing.
  • If you have changed the Font DPI in windows there may be issues calculating the width of the List Box, this can be addressed via the ListBoxCharacterWidth parameter in the Preferences.ini file.
  • When NumPresses=2, numbers aren't learned when there are items to autocomplete, but the number is only hit once.
  • Running another script in conjunction with TypingAid can cause extra characters to be typed occasionally (possible fix via I parameter to Input command, viewtopic.php?p=377459#p377459).
  • When Colemak v1.1 is the default keyboard layout on Windows 7 (and possibly XP or Vista, but untested), using ` and ~ as endkeys map to R and G respectively; so R and G terminate the word. Reported here. This can be worked around by removing ` and ~ from the "TerminatingCharacters" value in the Preferences.ini file and adding them to "ForceNewWordCharacters" (note the word you type following this character will not be learned).
Future Features:
  • A toggle hotkey to activate/suspend script, also via tray menu (configurable)
  • Add a way to delete words from the wordlist while the script is running
  • Add a tray menu to allow for configuring settings more easily
  • Possibly implement a method of checking to see if the typed letter actually typed a letter (when helper window is not open - check to see if caret moved).
  • Possibly add customized autocomplete combinations (such as send word and a space, or send word and a period, viewtopic.php?p=342637#p342637).
  • Allow a way to add more "weight" to words when you type/complete them so they jump up the list faster ( viewtopic.php?p=360304#p360304).
  • Add word replacement ( viewtopic.php?p=420853#p420853 ).
  • Add tiered wordlists (Parent>Child relationships) ( viewtopic.php?p=422458#p422458 ).
  • Allow TypingAid to send in non-raw format (for putting in special characters). ( viewtopic.php?p=427225#p427225 )
  • Allow users to customize shortcut keys. ( viewtopic.php?p=429062#p429062 )
  • Allow Enter as an autocomplete key. ( viewtopic.php?p=446987#p446987 )
  • Monitor the clipboard to find words to add to the list. ( viewtopic.php?p=464966#p464966 )
  • Add a way to use a hardcoded list of words rather than wordlist.txt
  • Add a new type of Helper Window which would basically be a self-contained edit window. ( viewtopic.php?p=496366#p496366 )
  • Add the ability to parse out and index CamelCase strings by UpperCase letters. ( viewtopic.php?p=536346#p536346 )
  • Warn the user when the Wordlist file does not exist or is empty. ( viewtopic.php?p=550021#p550021 )
  • Try to auto-determine the appropriate SendMethod. ( viewtopic.php?p=558700#p558700 )
  • Add a parameter to suppress a word from the list if it matches the currently typed word. ( http://www.autohotke...-39#entry588023 )
  • Add support for Russian ( http://www.autohotke...-38#entry553085 )
Credits:
Jordi S
Maniac
HugoV
kakarukeys
Asaptrad


Original Thread

#2 SoLong&Thx4AllTheFish

SoLong&Thx4AllTheFish
  • Members
  • 4999 posts

Posted 22 January 2010 - 02:59 PM

Added to wiki listing below the other two Intellisense scripts <!-- m -->http://www.autohotke... ... ng#Editors<!-- m -->

#3 SoLong&Thx4AllTheFish

SoLong&Thx4AllTheFish
  • Members
  • 4999 posts

Posted 22 January 2010 - 03:18 PM

Feature suggestion:

- Pressing del (or ^del) while in tooltip window on selected > word will delete that word/sentence from wordlist.txt

#4 maniac

maniac
  • Members
  • 311 posts

Posted 22 January 2010 - 03:41 PM

Thanks for adding it to the wiki.

Feature suggestion:

- Pressing del (or ^del) while in tooltip window on selected > word will delete that word/sentence from wordlist.txt


I'm not sure that would be a good idea for a few reasons:
A. Couldn't pop up a confirmation without being disruptive - accidental deletes would be hard to recover from.
B. I don't think words will need to be deleted very often, due to that I would prefer the deliberate action of actually being forced to modify the wordlist.txt file directly.

Plus it'd be a bit more of a pain to code since it can't plug directly into the learning code ;).

#5 SoLong&Thx4AllTheFish

SoLong&Thx4AllTheFish
  • Members
  • 4999 posts

Posted 22 January 2010 - 04:12 PM

I still think it could be useful, especially if you frequently mistype words (dyslectics of the world untie) it might get added to the learned words. Of course it is easy to edit the wordslist file but still... perhaps something as "mark for deletion" so the next time the user starts typingaid it will ask are you sure, or when exiting the program, that way it doesn't get in the way as such. Not a huge feature but something that could be added in TA version 7.3 or something :wink:

#6 arsan

arsan
  • Members
  • 105 posts

Posted 23 January 2010 - 06:19 AM

This is a useful tool. Thanks.

#7 SoLong&Thx4AllTheFish

SoLong&Thx4AllTheFish
  • Members
  • 4999 posts

Posted 23 January 2010 - 08:00 AM

Some ideas on Known Issues:

[*]If you move the cursor within the same line with the mouse and resume typing, the word will not reset.

Possible solution: Use MouseGetPos to check mouse position, once it moves clear word + tooltip (edit: or perhaps monitor mouseclicks)

[*]The caret position cannot be detected in certain applications, such as FireFox, OpenOffice.org, and Thunderbird. As a workaround for this the drop-down will open at the last position you clicked with your mouse, or you can open a helper window by hitting Ctrl-Shift-H.

Possible solutions:
- would be interesting to see if you indeed could use ACC or COM to get the caret position (see <!-- m -->http://www.autohotke...ic24234-15.html<!-- m --> don't know how ACC/COM works so can't help)
- If caret is 0,0 it means can't get correct value so you could show the helper window automatically (configurable, remember last position so the user doesn't have to move it 'every' time)
- OR still not accurate but closer to the caret position: use ControlGetFocus / ControlGetPos to get the X,Y of the control and either position helper window or the regular tooltip window somewhere in the control with an offset but that probably doesn't help much ...

Edit: Some guy got the caret position to work with firefox he said here <!-- m -->http://www.autohotke...php?t=53639<!-- m --> so there might be hope yet ...

#8 Laszlo

Laszlo
  • Fellows
  • 4713 posts

Posted 23 January 2010 - 06:24 PM

Here is a much simpler typing aid script. Maybe you could combine the ideas.

#9 maniac

maniac
  • Members
  • 311 posts

Posted 25 January 2010 - 12:02 PM

Some ideas on Known Issues:


[*]If you move the cursor within the same line with the mouse and resume typing, the word will not reset.

Possible solution: Use MouseGetPos to check mouse position, once it moves clear word + tooltip (edit: or perhaps monitor mouseclicks)

It's more complicated than that. What if you are in a small edit box and you click to the left of that box on the same line? You may not have changed the cursor position.

One thing I tried was tracking the old horizontal caret position and comparing it, but I ran into several issues with that.

Possible solutions:
- would be interesting to see if you indeed could use ACC or COM to get the caret position (see <!-- m -->http://www.autohotke...ic24234-15.html<!-- m --> don't know how ACC/COM works so can't help)
- If caret is 0,0 it means can't get correct value so you could show the helper window automatically (configurable, remember last position so the user doesn't have to move it 'every' time)
- OR still not accurate but closer to the caret position: use ControlGetFocus / ControlGetPos to get the X,Y of the control and either position helper window or the regular tooltip window somewhere in the control with an offset but that probably doesn't help much ...

Edit: Some guy got the caret position to work with firefox he said here <!-- m -->http://www.autohotke...php?t=53639<!-- m --> so there might be hope yet ...


Thanks, I'll have to look into those at some point. One thing I was hoping to implement was a way to remember the old helper window position (but I haven't tried to figure out how to get the window position when the helper is closed).

Here is a much simpler typing aid script. Maybe you could combine the ideas.

I like the ListBox Gui... that would be ideal to switch to.

#10 SoLong&Thx4AllTheFish

SoLong&Thx4AllTheFish
  • Members
  • 4999 posts

Posted 25 January 2010 - 12:34 PM

One thing I was hoping to implement was a way to remember the old helper window position (but I haven't tried to figure out how to get the window position when the helper is closed).

here you go
;Create helper window for showing tooltip
CreateHelperWindow()
{
   Global Helper_id
   IniRead, XY, Preferences.ini, HelperWindow, XY
   StringSplit, Pos, XY, `,
   Gui, Add, Text,,Tooltip appears here
   Gui, Show, X%Pos1% Y%Pos2%
   WinGet, Helper_id, ID,,Tooltip appears here
   WinSet, AlwaysOnTop, On, ahk_id %Helper_id%
   return
}

GuiClose:
SaveHelperWindowPos(Helper_id)
Return

SaveHelperWindowPos(Helper_id)
{
   WinGetPos, hX, hY, , , ahk_id %Helper_id%
   IniWrite, %hX%`,%hY%, Preferences.ini, HelperWindow, XY
   Gui, Hide
}
add this to preferences.ini
[HelperWindow]
XY=200,277
It will remember the position between sessions. If you skip the INI part it will of course remember only per session and you have to make the X & Y pos global.

Do you want me to have a go at the listbox?

#11 maniac

maniac
  • Members
  • 311 posts

Posted 25 January 2010 - 02:22 PM

Hey hugov, thanks. I added the Helper Window position save code with a small modification... I only read the ini file when launching the script and save it when exiting. 2.01 is now uploaded.

Feel free to try the listbox :). I assume you would be planning on simply switching over the "look" from the tooltip to the listbox rather than actually changing any functionality?

#12 maniac

maniac
  • Members
  • 311 posts

Posted 25 January 2010 - 02:35 PM

Also, would people find it useful to be able to increase the minimum length a word must be to learn the word without having to change the number of letters you have to type to pop up the wordlist?

IE at the default settings the script will learn both "come" and "communications", but the autocomplete is obviously much more useful for "communications" than "come".
What do you guys think?

#13 SoLong&Thx4AllTheFish

SoLong&Thx4AllTheFish
  • Members
  • 4999 posts

Posted 25 January 2010 - 02:45 PM

Also, would people find it useful to be able to increase the minimum length a word must be to learn the word without having to change the number of letters you have to type to pop up the wordlist?

IE at the default settings the script will learn both "come" and "communications", but the autocomplete is obviously much more useful for "communications" than "come".
What do you guys think?

The idea is to save keystrokes so a simple standard formula:

Length + 2 = new word to be added to the list

Little use to add come to the list if you have set the length variable to 3 but comet would save you 1 keystroke, perhaps another config option :-)

Re listbox: yep same as now. I already made the 'endless scrolling' (cycle) for a listbox a while back <!-- m -->http://www.autohotke...topic31618.html<!-- m -->

#14 maniac

maniac
  • Members
  • 311 posts

Posted 25 January 2010 - 02:55 PM

The idea is to save keystrokes so a simple standard formula:

Length + 2 = new word to be added to the list

Little use to add come to the list if you have set the length variable to 3 but comet would save you 1 keystroke, perhaps another config option :-)

Yeah, that's what I was thinking... length+2 as default, then add a parameter to control it.


Re listbox: yep same as now. I already made the 'endless scrolling' (cycle) for a listbox a while back <!-- m -->http://www.autohotke...topic31618.html<!-- m -->

Sounds good, I just hope it draws as fast as a tooltip or it won't work well enough.

#15 maniac

maniac
  • Members
  • 311 posts

Posted 25 January 2010 - 03:16 PM

Yeah, that's what I was thinking... length+2 as default, then add a parameter to control it.


Done, 2.02 uploaded. You can still force learn a word (ctrl-shift-c), so long as it's longer than "Length".



Also tagged with one or more of these keywords: ahk-1.0, ahk-1.1, scripts