AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Half-QWERTY: One-handed Typing
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Mon Feb 01, 2010 6:41 pm    Post subject: Reply with quote

do any of you guys use this on a consistent basis? how is it please let me know!
Back to top
wisp (guest)
Guest





PostPosted: Mon Feb 15, 2010 6:13 am    Post subject: Reply with quote

I would still like to be able to write one-handedly without having to press modifiers.

I still think it would be easy using dictionaries, like cell phones do (the good old T9 thingy).

Adding dictionaries easily would great!

I can't program. So if someone does it, please, let me know. ^_^

cesa.
facundo
@gmail
.com
Back to top
hugov



Joined: 27 May 2007
Posts: 2456

PostPosted: Mon Feb 15, 2010 10:51 am    Post subject: Reply with quote

wisp (guest) wrote:
I would still like to be able to write one-handedly without having to press modifiers.
I don't see how? Any suggestions?
wisp (guest) wrote:
I still think it would be easy using dictionaries, like cell phones do (the good old T9 thingy).
Look at typing aid here http://www.autohotkey.com/forum/viewtopic.php?t=53630
_________________
Tut 4 Newbies
TF : Text file & string lib, TF Forum
Back to top
View user's profile Send private message Visit poster's website
senseful



Joined: 26 Nov 2009
Posts: 11

PostPosted: Thu Mar 04, 2010 6:22 am    Post subject: Reply with quote

wisp (guest) wrote:
I would still like to be able to write one-handedly without having to press modifiers.

I still think it would be easy using dictionaries, like cell phones do (the good old T9 thingy).

Adding dictionaries easily would great!


I made a simple script, which follows enguneer's idea:

engunneer wrote:
it seems feasible

1. make a script with words as hotstrings (parse a dictionary website to get the words?)
Code:

:*:word::word
:*:another::another


2. loop read the file and parse each line to turn it into (using the mirror list)
Code:

:*:wwrd::word
:*:abwtger::another


3. Run the parsed script

4. Profit!


How to use it:

  1. Download a dictionary text file where each word is on its own line. (A good one I found is the 2of12 dictionary which is a part of the 12Dicts pakage. Simply scroll down to the "Official 12Dicts Package" section, download the zip file, then extract it. Use any of the dictionaries you want. View the readme for explanations about the differences between them).
  2. Run this AutoHotkey script I created (code is at the end of this post).
  3. When it asks for a dictionary file immediately after you launch it, select one of the text file dictionaries you want to use.
  4. Wait until it is done processing, it can take up to 5 minutes for a 40K word dictionary. You can check the progress by opening up the script and viewing "Variables and their contents". You should see a variable called gHotstringCount, which should be roughly twice the amount of words in the dictionary so about 80K for a 40K word dictionary. You can press F5 to refresh it.
  5. Once it is done, an .ahk file will be generated with a similar name in the same folder (e.g. C:\Dictionary.txt will generate C:\Dictionary-Half.ahk).
  6. Run this generated .ahk file which contains all the hotstrings.
  7. Type a word with only half of the keyboard and it should be converted after you press space. (For example, type "yhil" and it will convert it to "this", type "tges" and it will also be converted to "this".)


There are several issues which I didn't have time to fix:

  • Words that contain an "a", "z", "x" or "c" will not work correctly since they use the chars ";", "/", ".", and "," respectively, all of which are hotstring end chars (see #Hotstring in the help). I tried a quick and dirty solution by remapping the keys to different ones that aren't end chars, but I couldn't get it to work in my first attempt. The code I tried using will be at the end of the post.
  • If you use the backspace key while typing a hotstring, it won't convert the hotstring due to how hotstrings are implemented in autohotkey.
  • You will run into conflicts where the same hotstring will be needed for multiple words. Currently it just takes the first one and the second one is ignored and presented to you at the end letting you which words were ignored. You can either modify the dictionary to not have these duplicated words, or move the one you want to use to the top of the file. When I ran it on a 40K word list, I got about 1K conflicts.


Hopefully this can be a starting point for a useful script. Feel free to modify the code and improve it.

Here's the code:
Code:
; Convert Dictionary to Half Qwerty hotstrings
; v1.0 by Senseful (http://sensefulsolutions.blogspot.com/)

gHotstringsCreated_ := "" ; store a hash table of all hotstrings created to detect duplicates
gDuplicateHotstrings := "" ; store all duplicated hotstrings, to then show the user so they can fix the dictionary
gHotstringCount := 0 ; store the amount of hotstrings generated

CreateHalfDictionary()
CreateHalfDictionary() {
  ; e.g. inputDictionaryFile = C:\Dictionary.txt
  FileSelectFile, inputDictionaryFile, 1, , Select a Dictionary to Convert
  if ErrorLevel
    ExitApp
   
  ; e.g. outputDictionaryFile = C:\Dictionary-Half.ahk
  SplitPath, inputDictionaryFile, , fileDir, , fileName
  outputDictionaryFile := fileDir . "\" . fileName . "-Half.ahk"

  if (FileExist(outputDictionaryFile)) {
    ; 52 = 4 (Yes/No) + 48 (Exclamation)
    MsgBox, 52, , The file %outputDictionaryFile% already exists do you want to overwrite it?
    okToOverwrite := false
    IfMsgBox Yes
      okToOverwrite := true
    if (!okToOverwrite)
      ExitApp
  }
  FileDelete, %outputDictionaryFile%

  leftHandChars :=  "12345qwertasdfgzxcvb"
  rightHandChars := "67890poiuy;lkjh/.,mn"

  Loop, Read, %inputDictionaryFile%, %outputDictionaryFile%
  {
    word := A_LoopReadLine 
    AddHotstring(word, leftHandChars, rightHandChars)
    AddHotstring(word, rightHandChars, leftHandChars)
  }
 
  global gDuplicateHotstrings
  if (gDuplicateHotstrings != "") {
    ; there were duplicate hotstrings
    MsgBox, % "The following hotstrings were duplicates, and were not created:`n`n" . gDuplicateHotstrings
  }
 
  global gHotstringCount
  MsgBox, The dictionary was successfully created with %gHotstringCount% hotstrings. The file is located at: %outputDictionaryFile%
}

AddHotstring(word, fromChars, toChars) {
  global
  local hotstring := ""
  Loop, parse, word
  {
    local char := A_LoopField
    local replacementCharIndex := InStr(fromChars, char)
    local newChar
    if (replacementCharIndex > 0) {
      newChar := SubStr(toChars, replacementCharIndex, 1)
    } else {
      newChar := char
    }
    hotstring .= newChar
  }
 
  ; words like "x-ray" contain a dash (-) which cannot be a variable name, so replace it with an underscore (_)
  local hotstringHash := RegExReplace(hotstring, "\W", "_")
  if (gHotstringsCreated_%hotstringHash%) {
    ; duplicate hotstring found
    gDuplicateHotstrings .= hotstring . "`n"
    return
  }
  gHotstringsCreated_%hotstringHash% := 1
 
  if (hotstring == word) {
    ; the entire word can be written with one hand (e.g. junk), so instead of
    ; adding a hotstring "::junk::junk", just skip it
    return
  }
 
  gHotstringCount++
  local line := "::" . hotstring . "::" . word . "`n"
  FileAppend, %line%
}


Here's my first attempt at a fix which didn't work:
Code:
  ; The following are considered characters that end a hotstring: -()[]{}:;'"/\,.?!`n `t
  ; that means the following characters are the only non alphanumeric
  ; characters which can be a part of a hotstring: ``~@#$%^&*_+=|<>
  ; ; (a) will send ~ instead
  ; , (c) will send < instead
  ; . (x) will send > instead
  ; / (z) will send | instead

  ; setup the hotkeys that will switch these characters
  ; also make it so if they are pressed twice, it will send the actual punctuation character
  FileAppend, `;::~`n, %outputDictionaryFile%
  FileAppend, ::`~`~::`;`n, %outputDictionaryFile%
  FileAppend, ::aa::`;`n, %outputDictionaryFile%
 
  FileAppend, ,::<`n, %outputDictionaryFile%
  FileAppend, ::`<`<::,`n, %outputDictionaryFile%
  FileAppend, ::cc::,`n, %outputDictionaryFile%
 
  FileAppend, .::>`n, %outputDictionaryFile%
  FileAppend, ::`>`>::.`n, %outputDictionaryFile%
  FileAppend, ::xx::.`n, %outputDictionaryFile%
 
  FileAppend, /::|`n, %outputDictionaryFile%
  FileAppend, ::||::/`n, %outputDictionaryFile%
  FileAppend, ::zz::/`n, %outputDictionaryFile%
 
  leftHandChars :=  "12345qwertasdfgzxcvb"
  rightHandChars := "67890poiuy~lkjh|><mn" ; "67890poiuy;lkjh/.,mn"
Back to top
View user's profile Send private message
Arion



Joined: 21 Oct 2008
Posts: 3

PostPosted: Sun Mar 07, 2010 2:16 am    Post subject: Reply with quote

Great script!

Here's my little contribuition:

Code:
; Initialize variables
mirror_1 = 0
mirror_2 = 9
mirror_3 = 8
mirror_4 = 7
mirror_5 = 6
mirror_q = p
mirror_w = o
mirror_e = i
mirror_r = u
mirror_t = y
mirror_a = `;
mirror_s = l
mirror_d = k
mirror_f = j
mirror_g = h
mirror_z = /
mirror_x = .
mirror_c = ,
mirror_v = m
mirror_b = n

Return


; Declare useful hotkeys
Space & '::        Send, {Delete}
Space & Tab::      Send, {BackSpace}
Space & CapsLock:: Send, {Enter}
Shift & Space::    Send, %A_Space% ; To repeat several spaces without having to press multiple times


; Declare main hotkeys
Space:: Send, {Space}

Space & 1::
Space & 2::
Space & 3::
Space & 4::
space & 5::
Space & q::
Space & w::
Space & e::
Space & r::
Space & t::
Space & a::
Space & s::
Space & d::
Space & f::
Space & g::
Space & z::
Space & x::
Space & c::
Space & v::
Space & b::


; This is genial! Congratulations!
StringRight, thisKey, A_ThisHotkey, 1
StringTrimRight, mirrorKey, mirror_%thisKey%, 0


;  Utilizing the elegant ternary operator to get modifiers' state
modifiers :=   (GetKeyState("Ctrl") ? "^" : "")
             . (GetKeyState("Alt") ? "!" : "")
             . (GetKeyState("LWin") || GetKeyState("RWin") ? "#" : "")
             . (GetKeyState("Shift") ? "+" : "")


; Sends the resulting keys
Send %modifiers%{%mirrorKey%}

Return


#Esc::
Reload



I am writing this using only my left hand. It is still a little difficult and slow, but I am getting used to it.

Great work!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9
Page 9 of 9

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group