paullab Posted August 22, 2007 Share Posted August 22, 2007 (edited) Type-16 uses the numpad of a standard UK keyboard to type with, similar to the t9 predictive typing on a mobile phone I think that there is a patent on the t9 'stuff'. this was coded up without sight of that patent, so I have no idea on any ramifications. It was coded with a UK key keyboard in mind but that should not be a problem the numbers used for input are not the same as a mobile phone, but the positions are the same eg 2 on a phone (abc) corrsponds to 8 on the keypad. 1 on the numpad corresponds to 7 on a phone (pqrs) see the coments in the source for more words.zip contains number of 'clean' common words (UK spelling) any comments welcomeT16.au3words.zip Edited August 22, 2007 by paullab Wallpaper Rotatorwith overlay, Loop through a folder of wallpaper & another of overlay, then create a combined image and set it as the wallpaperE-Mail passthru, Send any file, even executables via e-mail as plain text. The recipient can then later re-construct them.Slideshow widget, A slideshow widget similar to the Vista onePredictive typing using the Numpad, Predictive typing using the numpad of a keyboar similar to that on a mobile phone (the key is the .t16 file).PSTools Front End, For Remote Admin. Just makes life a lot easier (Demonstrates executing external programs and passing parameters, tabbed form Handling STDIN/STDERR)FTP Helper application Up and Download files from an FTP server demonstrates this and Tooltray TipsShow a Map of your Post-codes/Zip Codes, Uses the Clipboard, Hotkeys, the system tray (incl. menus)Disc/CD/DVD Catalogue, Ideal for all those Covermount Discs (Demonstrates Array handling, executing DOS programs, handling STDIN/STDOUT recursive directory reads, file searching.)YAST , Yet another Stopwatch/Timer (Uses a hotkey, Copies to clipboard, handles multiple events and stays on top)Keyboard Status Indicator , Indicates status of NumLock, Caps Lock and Scroll Lock Keys, demonstrates API calling & System tray Icon Toggling Link to comment Share on other sites More sharing options...
danielblack2002 Posted April 7, 2011 Share Posted April 7, 2011 hi i opened up the program in autoIt but i cannot seem to run it? is there a gui file missing? please can you get back to me asap as I am developing a program that can help people with disabilities use a phone keypad style for typing on a computer and need to have the programme auto predict what they are trying to say within 3 goes with the style of them pressing a t9 keypad. any help would be appreciated. Link to comment Share on other sites More sharing options...
jvanegmond Posted April 7, 2011 Share Posted April 7, 2011 hi i opened up the program in autoIt but i cannot seem to run it? is there a gui file missing? please can you get back to me asap as I am developing a program that can help people with disabilities use a phone keypad style for typing on a computer and need to have the programme auto predict what they are trying to say within 3 goes with the style of them pressing a t9 keypad. any help would be appreciated. It was posted in 2007. For the AutoIt version made in 2007. Which AutoIt version are you trying to run it with? Probably one made in 2011, going from your errors. I can tell you now, that's not going to work without modifying the source code. I spent a few minutes trying to fix this but ran into problems with GuiList.au3 which I can't find anymore. Apparently GuiListBox.au3 is its successor but it does not define the same functions. I don't really deal much with AutoIt GUI, so maybe someone else can attempt this. You can find old versions of AutoIt here: http://www.autoitscript.com/autoit3/files/archive/autoit/ which is probably easier. Download one from 2007 around the time this was posted (take a pick) and try if it works. There is still a syntax error which will bug in any AutoIt here: $FormMain = GUICreate( $g_szVersion & " :T16" , 160, 385, $x, $y $WS_BORDER) There needs to be a comma between $y and $WS_BORDER. github.com/jvanegmond Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 7, 2011 Moderators Share Posted April 7, 2011 (edited) danielblack2002,I echo everything Manadar has just said. I have got the various include files and syntax errors sorted out, but there are other deeper problems with the script. I am looking at how to get it work, but I am having trouble understanding what is going on "under the hood" at the moment. Be patient and I will see what I can do over the next few days. M23I cannot make head nor tail of this script - no wonder it has lain unanswered for so long as I have no idea how it could ever have worked. There are some serious problems with its logic and structure. I will see if I can come up with something better - at worst it will actually run! Edited April 7, 2011 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 8, 2011 Moderators Share Posted April 8, 2011 danielblack2002,Here is my take on a predictive typing script. I have kept the same interface as the OP and tried to keep the same sort of functionality, but this one actually works (for me anyway!). expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <File.au3> #include <String.au3> #include <GuiListBox.au3> #include <GUIExtender.au3> Opt("GUIOnEventMode", 1) ; Check if already running $sTitle = "Predictor" If WinExists($sTitle) Then WinActivate($sTitle) Exit EndIf ; Set Globals Global $iKey_Delay = 1000 ; Adjust this as required Global $iMode = 0, $sMode = "Pred" Global $iCase = 0, $sCase = "Ab c" Global $iKey = 0, $iLast_Key = 0, $iKey_Press = -1 Global $aWord_List, $hGUI_Active, $sFile_Txt, $fAdded = False ; Create character map Global $aKey_Value[11][5] = [["", "", "", "", ""], _ ["p", "q", "r", "s", "7"], _ ["t", "u", "v", "8", ""], _ ["w", "x", "y", "z", "9"], _ ["g", "h", "i", "4", ""], _ ["j", "k", "l", "5", ""], _ ["m", "n", "o", "6", ""], _ ["1", "", "", "", ""], _ ["a", "b", "c", "2", ""], _ ["d", "e", "f", "3", ""], _ [" ", ".", ",", "", ""]] ; Create GUI $hGUI = GUICreate($sTitle & " - " & $sMode & " - " & $sCase, 155, 365, 10, 10) GUISetOnEvent($GUI_EVENT_CLOSE, "Exit_App") _GUIExtender_Init($hGUI) $mFileMenu = GUICtrlCreateMenu("File") GUICtrlCreateMenuItem("Load", $mFileMenu) GUICtrlSetOnEvent(-1, "Load_List") GUICtrlCreateMenuItem("Save", $mFileMenu) GUICtrlSetOnEvent(-1, "Save_List") GUICtrlCreateMenuItem("Exit", $mFileMenu) GUICtrlSetOnEvent(-1, "Exit_App") $mViewMenu = GUICtrlCreateMenu("View") $mKeysMenu = GUICtrlCreateMenuItem("Keys", $mViewMenu) GUICtrlSetOnEvent(-1, "Key_View") $mHelpMenu = GUICtrlCreateMenu("Help") GUICtrlCreateMenuItem("Help", $mHelpMenu) GUICtrlSetOnEvent(-1, "Help") GUICtrlCreateMenuItem("About", $mHelpMenu) GUICtrlSetOnEvent(-1, "About") $hInput = GUICtrlCreateInput("", 2, 0, 150, 20) _GUIExtender_Section_Start(20, 200) _GUIExtender_Section_Action(1) $hNP0 = GUICtrlCreateButton("0", 0, 184, 73, 33, 0) GUICtrlSetOnEvent(-1, "NP_0") $hNP1 = GUICtrlCreateButton("1", 0, 144, 33, 33, 0) GUICtrlSetOnEvent(-1, "NP_1") $hNP2 = GUICtrlCreateButton("2", 40, 144, 33, 33, 0) GUICtrlSetOnEvent(-1, "NP_2") $hNP3 = GUICtrlCreateButton("3", 80, 144, 33, 33, 0) GUICtrlSetOnEvent(-1, "NP_3") $hNP4 = GUICtrlCreateButton("4", 0, 104, 33, 33, 0) GUICtrlSetOnEvent(-1, "NP_4") $hNP5 = GUICtrlCreateButton("5", 40, 104, 33, 33, 0) GUICtrlSetOnEvent(-1, "NP_5") $hNP6 = GUICtrlCreateButton("6", 80, 104, 33, 33, 0) GUICtrlSetOnEvent(-1, "NP_6") $hNP7 = GUICtrlCreateButton("7", 0, 64, 33, 33, 0) GUICtrlSetOnEvent(-1, "NP_7") $hNP8 = GUICtrlCreateButton("8", 40, 64, 33, 33, 0) GUICtrlSetOnEvent(-1, "NP_8") $hNP9 = GUICtrlCreateButton("9", 80, 64, 33, 33, 0) GUICtrlSetOnEvent(-1, "NP_9") $hNPNumLock = GUICtrlCreateButton("Num", 0, 24, 33, 33, 0) $hNPDIv = GUICtrlCreateButton("/", 40, 24, 33, 33, 0) GUICtrlSetOnEvent(-1, "NP_Div") $hNPMul = GUICtrlCreateButton("*", 80, 24, 33, 33, 0) GUICtrlSetOnEvent(-1, "NP_Mul") $hNPAdd = GUICtrlCreateButton("+", 120, 64, 33, 73, 0) GUICtrlSetOnEvent(-1, "NP_Add") $hNPSub = GUICtrlCreateButton("-", 120, 24, 33, 33, 0) GUICtrlSetOnEvent(-1, "NP_Sub") GUICtrlCreateButton("Enter", 120, 144, 33, 73, 0) GUICtrlSetState(-1, $GUI_DISABLE) $hNPDot = GUICtrlCreateButton(".", 80, 184, 33, 33, 0) GUICtrlSetOnEvent(-1, "NP_Dot") _GUIExtender_Section_End() _GUIExtender_Section_Start(220, 130) $hList = GUICtrlCreateList("", 2, 220, 150, 130) _GUIExtender_Section_End() ; Hide keys at start _GUIExtender_Section_Extend(1, False) ; Set GUI required style GUISetStyle($WS_CAPTION) GUISetState(@SW_SHOW) ; Force NUMLOCK on Send("{NUMLOCK on}") ; we need to have numlock on ; Set initial state for hotkeys HotKeySet("{NUMPADDIV}", "NP_Div") EnableHotkeys() WinSetTrans($hGUI, "", 220) WinSetOnTop($hGUI, "", 1) ; Load file Load_List() ; Start timer for key press $iPress = TimerInit() ; Idle loop While 1 Sleep(10) WEnd ; Select mode Func NP_Div() $iMode += 1 $iMode = Mod($iMode, 4) Switch $iMode Case 0 ; Pred EnableHotkeys() $sMode = "Pred" Case 1 ; Num DisableHotkeys() $sMode = "Num" Case 2 ; Type DisableHotkeys() HotKeySet("{NUMPAD0}", "NP_0") $sMode = "Add" $hGUI_Active = WinGetHandle("[ACTIVE]") WinActivate($hGUI) Case 3 ; Case WinActivate($hGUI_Active) EnableHotkeys() $sMode = "Case" EndSwitch ; Show Mode WinSetTitle($hGUI, "", $sTitle & " - " & $sMode & " - " & $sCase) EndFunc ;==>NP_Div ; Backspace within input or change case when in case mode Func NP_Mul() ; Switch $iMode Case 3 ; Case Mode $iCase += 1 $iCase = Mod($iCase, 4) Switch $iCase Case 0 $sCase = "Ab c" Case 1 $sCase = "Ab C" Case 2 $sCase = "ABC" Case 3 $sCase = "abc" EndSwitch $sText = GUICtrlRead($hInput) Set_Case($sText) GUICtrlSetData($hInput, $sText) WinSetTitle($hGUI, "", $sTitle & " - " & $sMode & " - " & $sCase) Case Else ; Backspace Mode $sText = GUICtrlRead($hInput) $sText = StringLeft($sText, StringLen($sText) - 1) GUICtrlSetData($hInput, $sText) Find_Matches() EndSwitch EndFunc ;==>NP_Mul ; Select previous entry in list Func NP_Sub() $iIndex = _GUICtrlListBox_GetCurSel($hList) If $iIndex > 0 Then _GUICtrlListBox_SetCurSel($hList, $iIndex - 1) EndIf EndFunc ;==>NP_Sub ; Select next entry in list Func NP_Add() $iIndex = _GUICtrlListBox_GetCurSel($hList) _GUICtrlListBox_SetCurSel($hList, $iIndex + 1) EndFunc ;==>NP_Add ; Either paste selected word or add word in input to list Func NP_0() Switch $iMode Case 0 ; Pred mode $sText = GUICtrlRead($hList) If $sText Then ; If selection made Set_Case($sText) Send($sText) GUICtrlSetData($hInput, "") GUICtrlSetData($hList, "|") Else ; If not then use input $sText = GUICtrlRead($hInput) Send($sText) ; And save to word list ContinueCase EndIf Case 2 ; Add Mode _ArrayAdd($aWord_List, StringLower(GUICtrlRead($hInput))) _ArrayDisplay($aWord_List) $fAdded = True GUICtrlSetData($hInput, "") GUICtrlSetData($hList, "|") WinActivate($hGUI_Active) EnableHotkeys() $iMode = 0 $sMode = "Pred" WinSetTitle($hGUI, "", $sTitle & " - " & $sMode & " - " & $sCase) EndSwitch EndFunc ;==>NP_0 Func NP_Dot() Add_Char(10) EndFunc ;==>NP_Dot Func NP_1() Add_Char(1) EndFunc ;==>NP_1 Func NP_2() Add_Char(2) EndFunc ;==>NP_2 Func NP_3() Add_Char(3) EndFunc ;==>NP_3 Func NP_4() Add_Char(4) EndFunc ;==>NP_4 Func NP_5() Add_Char(5) EndFunc ;==>NP_5 Func NP_6() Add_Char(6) EndFunc ;==>NP_6 Func NP_7() Add_Char(7) EndFunc ;==>NP_7 Func NP_8() Add_Char(8) EndFunc ;==>NP_8 Func NP_9() Add_Char(9) EndFunc ;==>NP_9 Func Add_Char($iKey) If $iKey = $iLast_Key Then ; Same key so see if withint time limit If TimerDiff($iPress) < $iKey_Delay Then ; Set next available character Do $iKey_Press += 1 $iKey_Press = Mod($iKey_Press, 5) $sChar = $aKey_Value[$iKey][$iKey_Press] Until $sChar <> "" ; Add character to input in correct case $sText = GUICtrlRead($hInput) $iLen = StringLen($sText) $sText = StringLeft($sText, $iLen - 1) & $sChar Set_Case($sText) GUICtrlSetData($hInput, $sText) Else ; Add first character to input in correct case $iKey_Press = 0 $sChar = $aKey_Value[$iKey][$iKey_Press] $sText = GUICtrlRead($hInput) & $sChar Set_Case($sText) GUICtrlSetData($hInput, $sText) EndIf Else ; New key so add first character to input in correct case $iLast_Key = $iKey $iKey_Press = 0 $sChar = $aKey_Value[$iKey][$iKey_Press] $sText = GUICtrlRead($hInput) & $sChar Set_Case($sText) GUICtrlSetData($hInput, $sText) EndIf ; Fill list with possible matches Find_Matches() ; Reset timer for keypress $iPress = TimerInit() EndFunc ;==>Add_Char Func Set_Case(ByRef $sText) Switch $iCase Case 0 ; Sentence $sInit = StringLeft($sText, 1) $sRemainder = StringTrimLeft($sText, 1) $sText = StringUpper($sInit) & StringLower($sRemainder) Case 1 ; Proper $sText = _StringProper($sText) Case 2 ; All Upper $sText = StringUpper($sText) Case 3 ; All lower $sText = StringLower($sText) EndSwitch EndFunc ;==>Set_Case Func Key_View() ; Toggle key view and menu check If _GUIExtender_Section_State(1) Then GUICtrlSetState($mKeysMenu, $GUI_UNCHECKED) _GUIExtender_Section_Extend(1, False) Else GUICtrlSetState($mKeysMenu, $GUI_CHECKED) _GUIExtender_Section_Extend(1, True) EndIf EndFunc ;==>Key_View Func Exit_App() If $fAdded Then ; Ask about saving if words added Switch MsgBox(3, "Predictor", "You have added to the word list" & @CRLF & @CRLF & "Do you wish to save before exiting?") Case 2 ; Cancel Return Case 6 ; Yes Save_List() EndSwitch Else ; Ask if sure Switch MsgBox(4, "Predictor", "Are you sure?") Case 7 ; No Return EndSwitch EndIf ; Exit Exit EndFunc ;==>Exit_App Func Find_Matches() ; Start with delimiter so new data always replaces old $sMatches = "|" Local $sInput = GUICtrlRead($hInput) Local $iLen = StringLen($sInput) If $sInput <> "" Then ; Work through list to find matches For $i = 1 To UBound($aWord_List) - 1 If StringLeft($aWord_List[$i], $iLen) = $sInput Then $sMatches &= $aWord_List[$i] & "|" Next ; Add matches to list GUICtrlSetData($hList, $sMatches) ; Select a single match StringReplace($sMatches, "|", "", 0, 2) If @extended = 2 Then _GUICtrlListBox_SetCurSel($hList, 0) EndIf Else ; Clear list if no matches GUICtrlSetData($hList, "|") EndIf EndFunc ;==>Find_Matches Func Load_List() ; Load a list of words ; Open selection dialog $sFile_Txt = FileOpenDialog("Import Word List", @ScriptDir, "WordList (*.txt)", 4) If @error Then ; If no file selected set empty array MsgBox(0, "Info", "No list selected") $sFile_Txt = "" Global $aWord_List[1] = [0] Return EndIf ; Read file into array _FileReadToArray($sFile_Txt, $aWord_List) If @error Then ; If error the set empty array MsgBox(0, "Error", "Could not load file") $sFile_Txt = "" Global $aWord_List[1] = [0] Return EndIf EndFunc ;==>Load_List Func Save_List() Local $sHdg, $sMsg ; if no file loaded then ask for filename If Not $sFile_Txt Then $sFile_Txt = InputBox("FileName", "Please choose a filename for the word list") EndIf ; Save file If _FileWriteFromArray($sFile_Txt, $aWord_List, 1) Then $sHdg = "Info" $sMsg = "File list saved as" & @CRLF & $sFile_Txt $fAdded = False Else $sHdg = "Error" $sMsg = "File list NOT saved" EndIf MsgBox(0, $sHdg, $sMsg) EndFunc ;==>Save_List Func EnableHotkeys() HotKeySet("{NUMPADMULT}", "NP_Mul") HotKeySet("{NUMPADSUB}", "NP_Sub") HotKeySet("{NUMPADADD}", "NP_Add") HotKeySet("{NUMPADDOT}", "NP_Dot") HotKeySet("{NUMPAD0}", "NP_0") HotKeySet("{NUMPAD1}", "NP_1") HotKeySet("{NUMPAD2}", "NP_2") HotKeySet("{NUMPAD3}", "NP_3") HotKeySet("{NUMPAD4}", "NP_4") HotKeySet("{NUMPAD5}", "NP_5") HotKeySet("{NUMPAD6}", "NP_6") HotKeySet("{NUMPAD7}", "NP_7") HotKeySet("{NUMPAD8}", "NP_8") HotKeySet("{NUMPAD9}", "NP_9") EndFunc ;==>EnableHotkeys Func DisableHotkeys() HotKeySet("{NUMPADMULT}") HotKeySet("{NUMPADSUB}") HotKeySet("{NUMPADADD}") HotKeySet("{NUMPADDOT}") HotKeySet("{NUMPAD0}") HotKeySet("{NUMPAD1}") HotKeySet("{NUMPAD2}") HotKeySet("{NUMPAD3}") HotKeySet("{NUMPAD4}") HotKeySet("{NUMPAD5}") HotKeySet("{NUMPAD6}") HotKeySet("{NUMPAD7}") HotKeySet("{NUMPAD8}") HotKeySet("{NUMPAD9}") EndFunc ;==>DisableHotkeys Func About() MsgBox(0, "Predictor", "Predictive text via NumPad SMS" & @CRLF & @CRLF & "(c) Melba23 2011") EndFunc Func Help() $sMsg = "Predictor" & @CRLF & @CRLF & "NumPad keys act as SMS text buttons" & @CRLF & @CRLF & _ "Use NumPad / to select mode:" & @CRLF & @CRLF & _ "'Pred' - NumPad keys 1-9 & . act as SMS text buttons" & @CRLF & _ " List fills with matching word from loaded list" & @CRLF & @CRLF & _ " NumPad +/- selects option from list" & @CRLF & _ " NumPad 0 pastes selection into open app" & @CRLF & _ " If no list selection, input content pasted and added to loaded list" & @CRLF & @CRLF & _ "'Num' - NumPad works as normal" & @CRLF & @CRLF & _ "'Add' - Use normal keys to type into input" & @CRLF & _ " NumPad 0 adds input content to list" & @CRLF & @CRLF & _ "'Case' - NumPad * changes case of text in input" MsgBox(0, "Predictor", $sMsg) EndFuncI have made the on-screen keyboard a menu selectable option - you will need my GUIExtender UDF that you can find it in my sig. Run this and load the word.txt file attached to the OP. Then open a text editor. Use the NumPad 1-9 and . keys as SMS text buttons - the cycled characters are set at the beginning of the script and can be varied as you wish. As you enter text, the list fills with possible matches which can be selected using the NumPad +/- keys. NumPad 0 will paste the selected text into the editor - if no selection has been made, the input contents are pasted and added to the list.Use NumPad / to switch between modes - all is explained in the Help screen, although please ask if anything is unclear.I hope this is useful to you. If it not quite what you want, please let me know and we can work on tuning it to fit your (or rather the possible disabled users) requirements. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now