AutoHotkey Community

It is currently May 26th, 2012, 11:05 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: July 18th, 2008, 2:30 am 
Offline

Joined: June 4th, 2005, 1:54 am
Posts: 146
I've made an attempt at designing a new kind of on-screen keyboard, for people learning to touch type.

These were my base assumptions:

1) An on-screen keyboard is not easy to look at. It is a complex visual element. Finding the key you're looking for takes time.

2) Most of the time, you don't need the whole keyboard.

3) The most common use of an on-screen keyboard, when learning to touch type using a new layout, is correcting typos.

4) (And this one is not really correct: ) Most typos are 'finger slips', which happen when the user hits an adjacent key by mistake.

5) When learning a new layout, you get to a point where you have a rough idea of where the key you're looking for is located, but you're not quite sure.

I stand firm behind 1-3. 4 is probably wrong, which is why this keyboard is only a proof-of-concept (along with some other reasons, see below).

Basically what it does: Finds out what was the last character you deleted (presumably to correct a typo), and shows you what characters are adjacent to it on the keyboard.

Image

Click here for larger image.

Current major problems in the script:

1) The method used for getting the last key deleted is really stupid. I copy it to the clipboard, and it's really unreliable. Fortunately, the script is modular and this function can (and should be) easily replaced without changing anything else. I tried an in-memory keylogger routine as an alternative, but it had its own issues.

2) With frequent use, the script can be irritating. There should be a delay before showing the OSD, but I'm not sure how to implement it ("Sleep" or "A_TimeIdlePhysical" does not really cut it).

3) There's more, but honestly, I am sure others would be quick to point them out and I'm really tired (stayed up late coding this).

Bottom line: Tell me if you like the idea, and if you feel like making it better (both in idea and in implementation)

Code:
#SingleInstance Force
Gui, +LastFound +AlwaysOnTop -Caption +Owner
Gui, color, 000000
WinSet, Transparent, 150
Gui, font,w500 s50 ccccccc, Calibri
Gui, Add, Text, center vFarLeft y0,
Gui, Add, Text, center vLeft y0,
Gui, font, cYellow
Gui, Add, Text, center vMiddle y0,
Gui, font, ccccccc
Gui, Add, Text, center vRight y0,
Gui, Add, Text, center vFarRight y0,
WinY := A_ScreenHeight-130

Loop, 0x6B
  Hotkey, % "*~" . chr(A_Index+20), HideUI

return

Backspace::
CapsLock::
KeyToAnalyize:=ObtainKey()
LettersToShow:=AnalyzeKeys(KeyToAnalyize)
UpdateUI(LettersToShow)
Gosub,ShowUI
return


ObtainKey()
{
clipbackup:=ClipboardAll
Send, +{Left}^x
KeyDeleted:=Clipboard
Clipboard:=Clipbackup
Clipbackup:=
return %KeyDeleted%
}

AnalyzeKeys(KeyPressed)
{
global
q = ##QWE
w = #QWER
e = QWERT
r = WERTY
t = ERTYL
y = RTYLU
l = TYLUO
u = YLUOP
o = LUOP#
p = UOP##
a = ##ASD
s = #ASDF
d = ASDFG
f = SDFGH
g = DFGHJ
h = FGHJK
j = ghjki
k = hjki#
i = JKI##
z = ##ZXC
x = #ZXCV
c = ZXCVB
v = XCVBN
b = CVBNM
n = VBNM#
m = BNM##
Loop 26
  {
    Test:=chr(a_index+96)
    If (KeyPressed = chr(A_Index+96))
      {
      LetterPressed := chr(A_Index+96)
      Display := %LetterPressed%
      NewLetter := Yes
      Return Display
      } Else {
      Newletter := No
      }
  }
}

UpdateUI(keys)
{
global
stringsplit,stroke,keys
FarLeft =
Left =
Right =
FarRight =
If (stroke1 <> "#") {
  FarLeft:=stroke1
}

If (stroke2 <> "#") {
  Left:=stroke2
}

  Middle:=stroke3

If (stroke4 <> "#") {
  Right:=stroke4
}

If (stroke5 <> "#") {
  FarRight:=stroke5
}

GuiControl,Text,FarLeft,%FarLeft%
GuiControl,Text,Left,%Left%
GuiControl,Text,Middle,%Middle%
GuiControl,Text,Right,%Right%
GuiControl,Text,FarRight,%FarRight%

}

ShowUI:
  If (NewLetter = Yes) {
  Gui, Show,hide xCenter y%WinY% h93 NA,
  }
  NewLetter := No
return

HideUI:
Gui, hide
return



Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 26th, 2008, 4:47 am 
thanks very much
great piece of code!


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 26th, 2008, 6:40 pm 
Offline

Joined: November 24th, 2007, 9:07 pm
Posts: 774
I like the idea.

What's wrong with calling Sleep before showing the GUI? Seems to me that would be adequate for delaying the display.

Or if you're worried about the script being unresponsive, you could use SetTimer, and stop the timer after it runs once.

_________________
Ben

My Trac projects
My Wiki
[Broken] - My music


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Exabot [Bot] and 13 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group