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 

KeyOnDemand - new attempt at on-screen keyboard

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
ezuk



Joined: 04 Jun 2005
Posts: 122

PostPosted: Fri Jul 18, 2008 2:30 am    Post subject: KeyOnDemand - new attempt at on-screen keyboard Reply with quote

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.



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

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
Page 1 of 1

 
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