Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

On Screen Keyboard Help


  • Please log in to reply
6 replies to this topic
jgoley
  • Guests
  • Last active:
  • Joined: --
To give all of you an idea of what I need; this is my situation. I am partially disabled and cannot sit at my desktop for more than hour. A friend rigged a stand for my laptop so I can lay flat on my back and look straight up at the screen, but it is hard to type with my hands over my head. I am getting a wireless keyboard (BTC 9019URF)
http://www.byopvr.co... ... 0_0189.jpg , this keyboard has some non standard placement of a few keys and I am not that good at touch typing anyway. The keyboard will rest on my legs and I won't be able to even glance at it to see the keys.

I have looked for an on screen keyboard for days that would show the keys when you type them. Most will not unless they are part of a typing tutor program that only types in the program nowhere else, or they only work with a mouse. Then I stumbled on to Jon’s On-Screen Keyboard.
http://www.autohotke... ... Screen.htm It does soom of what I was looking for but has only the basic keys. I have played with the script for a few days but it is way over my head. I was able to add some keys but they don’t work and I don’t know why. Here is my modified attempt:

[code=auto:0]

; On-Screen Keyboard (requires XP/2k/NT) -- by Jon
; http://www.autohotkey.com
; This script creates a mock keyboard at the bottom of your screen that shows
; the keys you are pressing in real time. I made it to help me to learn to
; touch-type (to get used to not looking at the keyboard). The size of the
; on-screen keyboard can be customized at the top of the script. Also, you
; can double-click the tray icon to show or hide the keyboard.

;---- Configuration Section: Customize the size of the on-screen keyboard and
; other options here.

; Changing this font size will make the entire on-screen keyboard get
; larger or smaller:
k_FontSize = 10
k_FontName = Verdana ; This can be blank to use the system's default font.
k_FontStyle = Bold ; Example of an alternative: Italic Underline

; Names for the tray menu items:
k_MenuItemHide = Hide on-screen &keyboard
k_MenuItemShow = Show on-screen &keyboard

; To have the keyboard appear on a monitor other than the primary, specify
; a number such as 2 for the following variable. Leave it blank to use
; the primary:
k_Monitor =

;---- End of configuration section. Don't change anything below this point
; unless you want to alter the basic nature of the script.


;---- Alter the tray icon menu:
Menu, Tray, Add, %k_MenuItemHide%, k_ShowHide
Menu, Tray, Add, &Exit, k_MenuExit
Menu, Tray, Default, %k_MenuItemHide%
Menu, Tray, NoStandard

;---- Calculate object dimensions based on chosen font size:
k_KeyWidth = %k_FontSize%
k_KeyWidth *= 3
k_KeyHeight = %k_FontSize%
k_KeyHeight *= 3
k_KeyMargin = %k_FontSize%
k_KeyMargin /= 6
k_SpacebarWidth = %k_FontSize%
k_SpacebarWidth *= 12
k_KeyWidthHalf = %k_KeyWidth%
k_KeyWidthHalf /= 2

k_KeySize = w%k_KeyWidth% h%k_KeyHeight%
k_Position = x+%k_KeyMargin% %k_KeySize%

;---- Create a GUI window for the on-screen keyboard:
Gui, Font, s%k_FontSize% %k_FontStyle%, %k_FontName%
Gui, -Caption +E0x200 +ToolWindow
TransColor = F1ECED
Gui, Color, %TransColor% ; This color will be made transparent later below.

;---- Add a button for each key. Position the first button with absolute
; coordinates so that all other buttons can be positioned relative to it:
Gui, Add, Button, section %k_KeySize% xm+%k_KeyWidth%, 1
Gui, Add, Button, %k_Position%, 2
Gui, Add, Button, %k_Position%, 3
Gui, Add, Button, %k_Position%, 4
Gui, Add, Button, %k_Position%, 5
Gui, Add, Button, %k_Position%, 6
Gui, Add, Button, %k_Position%, 7
Gui, Add, Button, %k_Position%, 8
Gui, Add, Button, %k_Position%, 9
Gui, Add, Button, %k_Position%, 0
Gui, Add, Button, %k_Position%, -
Gui, Add, Button, %k_Position%, =
Gui, Add, Button, x+%k_KeyMargin% h%k_KeyHeight%, BkSp ; Auto-width.
Gui, Add, Button, x+%k_KeyMargin% h%k_KeyHeight%, Hm ; Auto-width.


Gui, Add, Button, xm y+%k_KeyMargin% h%k_KeyHeight%, Tab ; Auto-width.
Gui, Add, Button, %k_Position%, Q
Gui, Add, Button, %k_Position%, W
Gui, Add, Button, %k_Position%, E
Gui, Add, Button, %k_Position%, R
Gui, Add, Button, %k_Position%, T
Gui, Add, Button, %k_Position%, Y
Gui, Add, Button, %k_Position%, U
Gui, Add, Button, %k_Position%, I
Gui, Add, Button, %k_Position%, O
Gui, Add, Button, %k_Position%, P
Gui, Add, Button, %k_Position%, [
Gui, Add, Button, %k_Position%, ]
Gui, Add, Button, %k_Position%, \
Gui, Add, Button, x+%k_KeyMargin% h%k_KeyHeight%, Pup ; Auto-width.

Gui, Add, Button, xm y+%k_KeyMargin% h%k_KeyHeight%, Cplk ; Auto-width.
Gui, Add, Button, %k_Position%, A
Gui, Add, Button, %k_Position%, S
Gui, Add, Button, %k_Position%, D
Gui, Add, Button, %k_Position%, F
Gui, Add, Button, %k_Position%, G
Gui, Add, Button, %k_Position%, H
Gui, Add, Button, %k_Position%, J
Gui, Add, Button, %k_Position%, K
Gui, Add, Button, %k_Position%, L
Gui, Add, Button, %k_Position%, `;
Gui, Add, Button, %k_Position%, '
Gui, Add, Button, x+%k_KeyMargin% h%k_KeyHeight%, Enter ; Auto-width.
Gui, Add, Button, x+%k_KeyMargin% h%k_KeyHeight%, Pdn ; Auto-width.

; The first button below adds %A_Space% at the end to widen it a little,
; making the layout of keys next to it more accurately reflect a real keyboard:
Gui, Add, Button, xm y+%k_KeyMargin% h%k_KeyHeight%, Shift
Gui, Add, Button, %k_Position%, Z
Gui, Add, Button, %k_Position%, X
Gui, Add, Button, %k_Position%, C
Gui, Add, Button, %k_Position%, V
Gui, Add, Button, %k_Position%, B
Gui, Add, Button, %k_Position%, N
Gui, Add, Button, %k_Position%, M
Gui, Add, Button, %k_Position%, `,
Gui, Add, Button, %k_Position%, .
Gui, Add, Button, %k_Position%, /
Gui, Add, Button, x+%k_KeyMargin% h%k_KeyHeight%, Shift ; Auto-width.
Gui, Add, Button, x+%k_KeyMargin% h%k_KeyHeight%, ^ ; Auto-width.
Gui, Add, Button, x+%k_KeyMargin% h%k_KeyHeight%, End ; Auto-width.

Gui, Add, Button, xm y+%k_KeyMargin% h%k_KeyHeight%, Ctrl ; Auto-width.
Gui, Add, Button, h%k_KeyHeight% x+%k_KeyMargin%, Win ; Auto-width.
Gui, Add, Button, h%k_KeyHeight% x+%k_KeyMargin%, Alt ; Auto-width.
Gui, Add, Button, h%k_KeyHeight% x+%k_KeyMargin% w%k_SpacebarWidth%, Space
Gui, Add, Button, h%k_KeyHeight% x+%k_KeyMargin%, Alt ; Auto-width.
Gui, Add, Button, h%k_KeyHeight% x+%k_KeyMargin%, ?? ; Auto-width.
Gui, Add, Button, h%k_KeyHeight% x+%k_KeyMargin%, Ins ; Auto-width.
Gui, Add, Button, h%k_KeyHeight% x+%k_KeyMargin%, Del ; Auto-width.

;---- Show the window:
Gui, Show
k_IsVisible = y

WinGet, k_ID, ID, A ; Get its window ID.
WinGetPos,,, k_WindowWidth, k_WindowHeight, A

;---- Position the keyboard at the bottom of the screen (taking into account
; the position of the taskbar):
SysGet, k_WorkArea, MonitorWorkArea, %k_Monitor%

; Calculate window's X-position:
k_WindowX = %k_WorkAreaRight%
k_WindowX -= %k_WorkAreaLeft% ; Now k_WindowX contains the width of this monitor.
k_WindowX -= %k_WindowWidth%
k_WindowX /= 2 ; Calculate position to center it horizontally.
; The following is done in case the window will be on a non-primary monitor
; or if the taskbar is anchored on the left side of the screen:
k_WindowX += %k_WorkAreaLeft%

; Calculate window's Y-position:
k_WindowY = %k_WorkAreaBottom%
k_WindowY -= %k_WindowHeight%

WinMove, A,, %k_WindowX%, %k_WindowY%
WinSet, AlwaysOnTop, On, ahk_id %k_ID%
WinSet, TransColor, %TransColor% 220, ahk_id %k_ID%


;---- Set all keys as hotkeys. See www.asciitable.com
k_n = 1
k_ASCII = 45

Loop
{
Transform, k_char, Chr, %k_ASCII%
StringUpper, k_char, k_char
if k_char not in <,>,^,~,

BoBo
  • Guests
  • Last active:
  • Joined: --
If I'm right, you wanna know/display which key you've pressed on your keyboard. I thought that it would be enough to use the keyboards image as background for a Gui, and display the key which has been pressed using a coloured image which resides at a transparent on-top-layer.
Btw. type training courses/applications are often provide such an option.

Maybe someone can rotate the given image so it's exactly horizontal. That would it make easier to assign an on-top-key-indicator with AHK.

8)

BoBo
  • Guests
  • Last active:
  • Joined: --
Or display a rectangle at the image coord which represents the pressed key (relative to the images top/left coord). Its Colour should be configurable (as you said you're slightly color blind). It might make sense if its flashes so it's current position is easier to identify. Additionaly the key itself could be displayed at the bottom right coord, sized to your needs (even that could be enough, or?).

jagoley
  • Guests
  • Last active:
  • Joined: --

I thought that it would be enough to use the keyboards image as background for a Gui, and display the key which has been pressed using a coloured image which resides at a transparent on-top-layer.

I guess I don't know what a "keyboards image" is. Are you talking about about the above script or something different? What ever I use will need to be a full onscreen keyboard.

And what is a transparent on-top-layer?

BoBo
  • Guests
  • Last active:
  • Joined: --

I guess I don't know what a "keyboards image" is

I guess you're wrong (as long as your name isn't Steve Wonder). That's an image of your keyboard, right?
Posted Image

And what is a transparent on-top-layer

An image (the blue rectangle) will be displayed on top of the above 'keyboard image' at the coords which are assigned to the original key you've pressed. Additionally there could be another indicator at the bottom right (or wherever you want) which displays the pressed key.
Hope that helps to start with.

The white background needs to be set transparent using WinSet, TransColor. :wink:

jagoley
  • Guests
  • Last active:
  • Joined: --
Thank you! No I am not blind. :lol: I thought you were talking about something in the scripting language not a Picture! They always say a picture is worth a thousand words.

I understand what you are getting at. Thank you. I'll follow up on this.

Micahs
  • Members
  • 463 posts
  • Last active: Mar 01 2013 06:01 AM
  • Joined: 01 Dec 2006
This is a bit late in the game, but if you're still interested:
http://www.autohotke...ic.php?p=116058
I added the capability to highlight keys typed on the physical keyboard.
Posted Image