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 

On-Screen Keyboard
Goto page 1, 2  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
Jon



Joined: 28 Apr 2004
Posts: 373

PostPosted: Wed Nov 17, 2004 9:06 pm    Post subject: On-Screen Keyboard Reply with quote

This script creates a small keyboard at the bottom of your screen which shows you which keys you have pressed. I made it to help me to learn to touch-type so I get used to not looking at the keyboard. I looked for a program that would do this but couldn't find one so I decided to make one. I haven't added all the buttons but I will add more later. I've added the main ones though. It may look a bit large on a lower resolution setting ,. I have got quite a high one.

Hide/Show/Exit via tray menu

Requires Autohotkey 1.0.23+

Code:
Menu, Tray, Add, Show
Menu, Tray, Add, Hide
Menu, Tray, Add, Exit
Menu, Tray, NoStandard

Gui, -Caption +E0x200 +ToolWindow
Gui, Color, F1ECED

;Adds Number Buttons

i=1
x=56

loop, 9
{
Gui, Add, Button, x%x% y20 w30 h30, %i%
i++
x+=32
}

;Adds keyboard Buttons


Gui, Add, Button, x%x% y20 w30 h30, 0

Gui, Add, Button, x71 y52 w30 h30, Q
Gui, Add, Button, x103 y52 w30 h30, W
Gui, Add, Button, x135 y52 w30 h30, E
Gui, Add, Button, x167 y52 w30 h30, R
Gui, Add, Button, x199 y52 w30 h30, T
Gui, Add, Button, x231 y52 w30 h30, Y
Gui, Add, Button, x263 y52 w30 h30, U
Gui, Add, Button, x295 y52 w30 h30, I
Gui, Add, Button, x327 y52 w30 h30, O
Gui, Add, Button, x359 y52 w30 h30, P

Gui, Add, Button, x84 y84 w30 h30, A
Gui, Add, Button, x116 y84 w30 h30, S
Gui, Add, Button, x148 y84 w30 h30, D
Gui, Add, Button, x180 y84 w30 h30, F
Gui, Add, Button, x212 y84 w30 h30, G
Gui, Add, Button, x244 y84 w30 h30, H
Gui, Add, Button, x276 y84 w30 h30, J
Gui, Add, Button, x308 y84 w30 h30, K
Gui, Add, Button, x340 y84 w30 h30, L
Gui, Add, Button, x372 y84 w30 h30, `;

Gui, Add, Button, x34 y116 w30 h30, Shift
Gui, Add, Button, x66 y116 w30 h30, \
Gui, Add, Button, x98 y116 w30 h30, Z
Gui, Add, Button, x130 y116 w30 h30, X
Gui, Add, Button, x162 y116 w30 h30, C
Gui, Add, Button, x194 y116 w30 h30, V
Gui, Add, Button, x226 y116 w30 h30, B
Gui, Add, Button, x258 y116 w30 h30, N
Gui, Add, Button, x290 y116 w30 h30, M
Gui, Add, Button, x322 y116 w30 h30,`,
Gui, Add, Button, x354 y116 w30 h30, .
Gui, Add, Button, x386 y116 w30 h30, /

Gui, Add, Button, x145 y148 w195 h30, Space

;Positions keyboard


ControlGetPos,,, dW, dH, SysListView321, ahk_class Progman   

dw/=2
dw-=225

dh-=190

Gui, Show, x%dw% y%dh% h185 w450, Keyboard

WinSet, AlwaysOnTop, On, Keyboard

WinSet, TransColor,F1ECED 220, Keyboard

;Sets all keys as hotkeys see asciitable.com

n=1

ASCII = 46

Loop
{
      Transform, Char, Chr, %ASCII%
   StringUpper, Char, Char

if ASCII <> 32
if char not in <,>,^,~,,`,
{
Hotkey, ~%Char%, click
Hotkey, ~+%Char%, click
}

if ASCII=92
break

ASCII++
}

Hotkey, ~`,, click
Hotkey, ~+`,, click

return

;Clicks Button controls when corresponding key is pressed

click:

StringRight, ThisHotkey, A_ThisHotkey, 1
Stringleft, shiftvar, A_ThisHotkey, 2

if shiftvar=~+
{
ControlClick,Shift, Keyboard, , LEFT, 1, D
sleep, 100
}
ControlClick,%ThisHotkey%, Keyboard, , LEFT, 1, D
sleep, 100
ControlClick,%ThisHotkey%, Keyboard, , LEFT, 1, U
Return

;Clicks space bar button

~SPACE::
ControlClick,Space, Keyboard, , LEFT, 1, D
sleep, 100
ControlClick,Space, Keyboard, , LEFT, 1, U
Return

GuiClose:
ExitApp

Show:
Gui, Show
return

Hide:
Gui, Cancel
return

Exit:
exitapp


edit:

most recent version can now be found here (thanks to Chris)-

http://www.autohotkey.com/docs/scripts/KeyboardOnScreen.htm


Last edited by Jon on Wed Jan 09, 2008 8:53 am; edited 4 times in total
Back to top
View user's profile Send private message Send e-mail
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10474

PostPosted: Wed Nov 17, 2004 9:28 pm    Post subject: Reply with quote

Wow, that's pretty amazing. I can see why the instant feedback is a great help while typing because you can keep your eyes on the screen. And your use of a transparent background is a great bonus.

Thanks for sharing it.
Back to top
View user's profile Send private message Send e-mail
Titan



Joined: 11 Aug 2004
Posts: 5376
Location: /b/

PostPosted: Wed Nov 17, 2004 9:37 pm    Post subject: Reply with quote

Really cool, its fantastic. Lol I wish I had something like this when I was learning touchtyping Razz

It would be cool to have a line of text showing the most recent keys pressed, a small suggestion.

Once again tyvm for sharing it Very Happy
Back to top
View user's profile Send private message Visit poster's website
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Wed Nov 17, 2004 9:50 pm    Post subject: Reply with quote

How would I make this work with the Send command of another script? Currently, it doesn't work with my half-keyboard script, or any other send command for that matter. Would it help to disable the hook on the half-keyboard?
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10474

PostPosted: Wed Nov 17, 2004 10:02 pm    Post subject: Reply with quote

The reason it doesn't work is that the above script uses pass-through hotkeys, which are a feature of the keyboard hook. As a side-effect, the keyboard hook is designed to ignore hotkey activations triggered by any script's use of the Send command.

You would probably have to modify the script above to use the Input command rather than a series of single-character hotkeys.
Back to top
View user's profile Send private message Send e-mail
exhueydriver



Joined: 12 Jul 2004
Posts: 51
Location: Fife,Wa

PostPosted: Thu Nov 18, 2004 2:50 am    Post subject: Reply with quote

This program, and the people on this forum never cease to amaze me!
Since I haven't had the time to study up on the gui stuff, can you tell me
how to make the "Home" keys(F & J) a different color, or underline them?
When it comes to touch typing, I REALLY need help.
Thanks
Don
Back to top
View user's profile Send private message
Rajat



Joined: 28 Mar 2004
Posts: 1718

PostPosted: Thu Nov 18, 2004 4:15 am    Post subject: Reply with quote

its so cool to look at!
_________________
Back to top
View user's profile Send private message
BoBo
Guest





PostPosted: Thu Nov 18, 2004 5:21 pm    Post subject: Reply with quote

Stumbled over an AHK version conflict. Would have been smart to provide a note that this script works with >= 1.0.23+ Wink


Quote:
---------------------------
JonsTypist.ahk
---------------------------
Error: Parameter #1 is not a valid WinSet attribute.

Specifically: TransColor

Line#
061: Gui,Add,Button,x145 y148 w195 h30,Space

066: ControlGetPos,,,dW,dH,SysListView321,ahk_class Progman

068: dW /= 2

069: dW -= 225

071: dH -= 190

073: Gui,Show,x%dw% y%dh% h185 w450,Keyboard

075: WinSet,AlwaysOnTop,On,Keyboard

---> 077: WinSet,TransColor,F1ECED 220,Keyboard


The program will exit.
---------------------------
OK
---------------------------


Thx for listening.

Cool
Back to top
Jon



Joined: 28 Apr 2004
Posts: 373

PostPosted: Thu Nov 18, 2004 6:58 pm    Post subject: Reply with quote

Thanks for your comments Smile


Quote:
It would be cool to have a line of text showing the most recent keys pressed, a small suggestion.


That's a good idea, I'll try and add it (as soon as I work out the best way to implement it). I also noticed that it is hard to watch the keyboard and what you are typing at the same time.


Quote:

Stumbled over an AHK version conflict. Would have been smart to provide a note that this script works with >= 1.0.23+


Thanks, I'll edit my post.
Back to top
View user's profile Send private message Send e-mail
Wingfat



Joined: 23 Aug 2004
Posts: 193
Location: East Bay, California USA

PostPosted: Thu Nov 18, 2004 8:00 pm    Post subject: Reply with quote

very functional! i know of a few people that are going to love this. A freind of mine was just asking if the Onscreen Keyboard in WinXP could do the same thing.
- - - - -
Could be me but the shift only shows a down status when combined with another key. Should it not show that it is being pressed with out having to press another key. not a big deal though.
- - - - - -
_________________
----------------------------
Wingfool you fat! I mean, Wingfat you fool!
Line from Woody Allen's movie "What's Up Tiger Lilly?"
-----------------------------
Back to top
View user's profile Send private message
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Thu Nov 18, 2004 8:20 pm    Post subject: Reply with quote

The screen was indeed too big for mine, and I am already an excellent typist anyway. But I thought I'd like it better if it displayed one key at a time, rather than the enitre keyboard at once. Here I've modified the code to show the key in the top left of the screen. It is very rudimentary and has an untold number of bugs, but it will work if you press one key at a time slowly. I wouldn't use this, but I'm just throwing this in if someone else wants to run with it.

Code:
;Sets all keys as hotkeys see asciitable.com

n=1

ASCII = 46

Loop
{
      Transform, Char, Chr, %ASCII%
   StringUpper, Char, Char

if ASCII <> 32
if char not in <,>,^,~,,`,
{
Hotkey, ~%Char%, tip
Hotkey, ~+%Char%, tip
}

if ASCII=92
break

ASCII++
}

Hotkey, ~`,, tip
Hotkey, ~+`,, tip

return

;Displays key when it is pressed.

tip:

StringRight, ThisHotkey, A_ThisHotkey, 1
Stringleft, shiftvar, A_ThisHotkey, 2

if shiftvar=~+
{
Progress, B W53 X0 Y0 C00 ZH0,, Shift
Sleep, 100
}
Progress, B W35 X0 Y0 C00 ZH0,, %ThisHotkey%
sleep, 2000
Progress off
Return

;Displays space bar button

~SPACE::
Progress, B W65 X0 Y0 C00 ZH0,, Space
sleep, 2000
Progress off
Return
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10474

PostPosted: Thu Nov 18, 2004 9:03 pm    Post subject: Reply with quote

Besides the coolness factor, do you all think this script would interest 10% or more of site visitors, and thus should be posted in the script showcase? This is assuming Jon would want it posted there.
Back to top
View user's profile Send private message Send e-mail
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Thu Nov 18, 2004 10:07 pm    Post subject: Reply with quote

Well, like I said, I don't use it, but others may find it to be quite useful. Like I said, for lower resolutions it is a bit intrusive. However, I find the ASCII hotkey code to be very interesting. I'm trying to think of more applications for using ASCII to code hotkeys, especially because it would make scripts such as this, including my half-keyboard script, more efficient and less tedious to write. You could post it just for that, to show that new, creative ways to make hotkeys other than "^X::" are possible. Also, there's the coolness factor.
Back to top
View user's profile Send private message
Gre



Joined: 12 Oct 2004
Posts: 77
Location: São Paulo ,Brazil

PostPosted: Thu Nov 18, 2004 11:24 pm    Post subject: Reply with quote

Tryed this script now,it is really nice.I think it is a good one to be posted in the showcase
Back to top
View user's profile Send private message
BoBo
Guest





PostPosted: Fri Nov 19, 2004 8:46 am    Post subject: Reply with quote

Yep, showcase.

As an innovative tool/script shows AHK's power. Thought about if it would make sense to classify script samples with keywords and/or a download rating ? This way the popularity of a script could be identified easily.

Cool
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
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