From b29e00bb4189756f675f4723eb22e3a4888d7ab8 Mon Sep 17 00:00:00 2001 From: Theclaws Date: Tue, 17 Nov 2015 04:34:01 -0500 Subject: [PATCH 1/3] Introduce Bulk Learning feature --- Source/TypingAid.ahk | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Source/TypingAid.ahk b/Source/TypingAid.ahk index e11d755..a4bd7af 100644 --- a/Source/TypingAid.ahk +++ b/Source/TypingAid.ahk @@ -1099,6 +1099,7 @@ BuildTrayMenu() Menu, Tray, NoStandard Menu, Tray, add, Settings, Configuration Menu, Tray, add, Pause, PauseResumeScript + Menu, Tray, add, Bulk Learn, BulkLearnFromClipboardMenu IF (A_IsCompiled) { Menu, Tray, add, Exit, ExitScript @@ -1258,6 +1259,17 @@ if (g_PauseState == "Paused") } Return + +BulkLearnFromClipboardMenu: +MsgBox, 4, Bulk-learn words from clipboard contents, Would you like to continue? (press Yes or No) +IfMsgBox No +{ + Return +} +BulkLearnFromClipboard(clipboard) +Return + + ExitScript: ExitApp Return From 7aa2a842626b9aed1bd3ca68a4aca0e61bb86bd6 Mon Sep 17 00:00:00 2001 From: Theclaws Date: Tue, 17 Nov 2015 04:35:05 -0500 Subject: [PATCH 2/3] Update Wordlist.ahk --- Source/Includes/Wordlist.ahk | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/Source/Includes/Wordlist.ahk b/Source/Includes/Wordlist.ahk index b5bc519..a605992 100644 --- a/Source/Includes/Wordlist.ahk +++ b/Source/Includes/Wordlist.ahk @@ -306,7 +306,7 @@ CheckValid(Word,ForceLearn=false) { return } - } else if ( RegExMatch(Word, "S)[a-zA-Zà-öø-ÿÀ-ÖØ-ß]") = 0 ) + } else if ( RegExMatch(Word, "S)[a-zA-Zà-öø-ÿÀ-ÖØ-ß]") = 0 ) { Return } @@ -467,12 +467,34 @@ StrUnmark(string) { ; Remove combining marks and return result. string := RegExReplace(StrGet(&buf, len, "UTF-16"), "\pM") - StringReplace, string, string, æ, ae, All - StringReplace, string, string, Æ, AE, All - StringReplace, string, string, œ, oe, All - StringReplace, string, string, Œ, OE, All - StringReplace, string, string, ß, ss, All + StringReplace, string, string, æ, ae, All + StringReplace, string, string, Æ, AE, All + StringReplace, string, string, œ, oe, All + StringReplace, string, string, ÂŒ, OE, All + StringReplace, string, string, ß, ss, All return, string -} \ No newline at end of file +} + +;------------------------------------------------------------------------ + +BulkLearnFromClipboard(textblock) +{ + global g_TerminatingCharactersParsed + + ;Display progress bar window... + Progress, M, Please wait..., Bulk learning..., %g_ScriptTitle% + + Loop, Parse, textblock, %g_TerminatingCharactersParsed%`r`n%A_Tab%%A_Space% + { + ;Display words to show progress... + Progress, 50, Please wait..., %A_Index%: %A_LoopField%, %g_ScriptTitle% + AddWordToList(A_LoopField, 0,"ForceLearn") + } + + ;Turn off progress bar window... + Progress, Off + + return +} From db2101ed6cfe86e8ff4c2f9b5f432e2109b09a84 Mon Sep 17 00:00:00 2001 From: Theclaws Date: Tue, 22 Dec 2015 15:34:40 -0500 Subject: [PATCH 3/3] Cosmetic fix to Bulk Learn Progress Bar Pre-scan the clipboard to get word count so that the progress bar has an better cosmetic appearance --- Source/Includes/Wordlist.ahk | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Source/Includes/Wordlist.ahk b/Source/Includes/Wordlist.ahk index a605992..906d360 100644 --- a/Source/Includes/Wordlist.ahk +++ b/Source/Includes/Wordlist.ahk @@ -485,11 +485,20 @@ BulkLearnFromClipboard(textblock) ;Display progress bar window... Progress, M, Please wait..., Bulk learning..., %g_ScriptTitle% - + + ;Count how many individual items there are, we need this number to display + ;an accurate progress bar. + Loop, Parse, textblock, %g_TerminatingCharactersParsed%`r`n%A_Tab%%A_Space% + { + ;Count the individual items + Counter++ + } + Loop, Parse, textblock, %g_TerminatingCharactersParsed%`r`n%A_Tab%%A_Space% { ;Display words to show progress... - Progress, 50, Please wait..., %A_Index%: %A_LoopField%, %g_ScriptTitle% + ProgressPercent := Round(A_Index/Counter * 100) + Progress, %ProgressPercent%, Please wait..., %A_LoopField%, %g_ScriptTitle% AddWordToList(A_LoopField, 0,"ForceLearn") }