Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

On Screen KeyBoard that can Type


  • Please log in to reply
12 replies to this topic
None
  • Members
  • 3199 posts
  • Last active: Nov 05 2015 09:55 PM
  • Joined: 28 Nov 2009
This is a On Screen KeyBoard that uses SendPlay, so it will probably confuse some keylogger programs.
(why you would be using a computer you don't trust I don't know)

The Shift and CapsLock Buttons only apply to the letters the keyboard sends.

The way it switches back may make some programs behave oddly.
When I try it on my Google toolbar the letters always appear at the front so hello comes out as olleh. :D

Row=5 ;This is the BIG Gui 
Gui, Add, Button, x5 y%Row% w20 h20 gSendP , ``
Gui, Add, Button, x30 y%Row% w20 h20 gSendP , 1
Gui, Add, Button, x55 y%Row% w20 h20 gSendP, 2
Gui, Add, Button, x80 y%Row% w20 h20 gSendP , 3
Gui, Add, Button, x105 y%Row% w20 h20 gSendP , 4
Gui, Add, Button, x130 y%Row% w20 h20 gSendP , 5
Gui, Add, Button, x155 y%Row% w20 h20 gSendP , 6
Gui, Add, Button, x180 y%Row% w20 h20 gSendP , 7
Gui, Add, Button, x205 y%Row% w20 h20 gSendP , 8
Gui, Add, Button, x230 y%Row% w20 h20 gSendP , 9
Gui, Add, Button, x255 y%Row% w20 h20 gSendP , 0
Gui, Add, Button, x280 y%Row% w20 h20 gSendP , -
Gui, Add, Button, x305 y%Row% w20 h20 gSendP , =
Gui, Add, Button, x330 y%Row% w20 h20 gSendP , \
Gui, Add, Button, x355 y%Row% w20 h20 , Bs
Row=30
Gui, Add, Button, x5 y%Row% w30 h20 , Tb
Gui, Add, Button, x40 y%Row% w20 h20 gSendP , Q
Gui, Add, Button, x65 y%Row% w20 h20 gSendP , W
Gui, Add, Button, x90 y%Row% w20 h20 gSendP , E
Gui, Add, Button, x115 y%Row% w20 h20 gSendP , R
Gui, Add, Button, x140 y%Row% w20 h20 gSendP , T
Gui, Add, Button, x165 y%Row% w20 h20 gSendP , Y
Gui, Add, Button, x190 y%Row% w20 h20 gSendP , U
Gui, Add, Button, x215 y%Row% w20 h20 gSendP , I
Gui, Add, Button, x240 y%Row% w20 h20 gSendP , O
Gui, Add, Button, x265 y%Row% w20 h20 gSendP , P
Gui, Add, Button, x290 y%Row% w20 h20 gSendP , [
Gui, Add, Button, x315 y%Row% w20 h20 gSendP , ]
Gui, Add, Button, x340 y%Row% w35 h28 , En
Row=55
Gui, Add, Button, x5 y%Row% w40 h20 , Cl
Gui, Add, Button, x50 y%Row% w20 h20 gSendP , A
Gui, Add, Button, x75 y%Row% w20 h20 gSendP , S
Gui, Add, Button, x100 y%Row% w20 h20 gSendP , D
Gui, Add, Button, x125 y%Row% w20 h20 gSendP , F
Gui, Add, Button, x150 y%Row% w20 h20 gSendP , G
Gui, Add, Button, x175 y%Row% w20 h20 gSendP , H
Gui, Add, Button, x200 y%Row% w20 h20 gSendP , J
Gui, Add, Button, x225 y%Row% w20 h20 gSendP , K
Gui, Add, Button, x250 y%Row% w20 h20 gSendP , L
Gui, Add, Button, x275 y%Row% w20 h20 gSendP , `;
Gui, Add, Button, x300 y%Row% w20 h20 gSendP , '
Gui, Add, Button, x325 y%Row% w50 h20 , En
Row=80
Gui, Add, Button, x5 y%Row% w55 h20 , Shift
Gui, Add, Button, x65 y%Row% w20 h20 gSendP , Z
Gui, Add, Button, x90 y%Row% w20 h20 gSendP , X
Gui, Add, Button, x115 y%Row% w20 h20 gSendP , C
Gui, Add, Button, x140 y%Row% w20 h20 gSendP , V
Gui, Add, Button, x165 y%Row% w20 h20 gSendP , B
Gui, Add, Button, x190 y%Row% w20 h20 gSendP , N
Gui, Add, Button, x215 y%Row% w20 h20 gSendP , M
Gui, Add, Button, x240 y%Row% w20 h20 gSendP , `,
Gui, Add, Button, x265 y%Row% w20 h20 gSendP , .
Gui, Add, Button, x290 y%Row% w20 h20 gSendP , /
Gui, Add, Button, x315 y%Row% w60 h20 , Shift
Row=105
Gui, Add, Text, x5 y%Row% w70 h20 , CapsLock Off
Gui, Add, Button, x90 y%Row% w145 h20 , Space
Gui, Show, xCenter y820 h130 w380, GUI Keyboard
WinSet, AlwaysOnTop, On , GUI Keyboard

Caps:=0 ;Preset Caps and Shift to off
Sh:=0

SetTimer WWA, 100 ;Monitor What Window is Active so it can send to the correct window 
WWA:
WinGetActiveTitle, Active
If Active<>GUI Keyboard
Dest=%Active%
Return

GuiClose:
ExitApp
Return

SendP: ;sub that sends most keys
If((Caps+Sh)=0) ;check Caps and Shift state
StringLower, Letter, A_GuiControl ;if off make lower
Else
StringUpper, Letter, A_GuiControl ;if on make UPPER
if Sh=1 ;if shift was on turn it off
GoSub ShiftOff
WinActivate %Dest% ;Activate the window to sent to
SendPlay %Letter%
Return

ButtonSpace: ; Send the keys that don't heve the actual letter on them
WinActivate %Dest%
SendPlay {Space}
Return

ButtonBs:
WinActivate %Dest%
SendPlay {BS}
Return

ButtonTb:
WinActivate %Dest%
SendPlay {Tab}
Return

ButtonEn:
WinActivate %Dest%
SendPlay {Enter}
Return

ButtonCl: ;Change the Caps state and it's label on the Gui
Caps:=!Caps
If Caps
ControlSetText, Static1, CapsLock On, GUI Keyboard
Else
ControlSetText, Static1, CapsLock Off, GUI Keyboard
Return

ButtonShift: ;Turn Shift on and Change the Buttons to shifted state
ControlSetText, Button1, ~, GUI Keyboard
ControlSetText, Button2, !, GUI Keyboard
ControlSetText, Button3, @, GUI Keyboard
ControlSetText, Button4, #, GUI Keyboard
ControlSetText, Button5, $, GUI Keyboard
ControlSetText, Button6, `%, GUI Keyboard
ControlSetText, Button7, ^, GUI Keyboard
ControlSetText, Button8, &, GUI Keyboard
ControlSetText, Button9, *, GUI Keyboard
ControlSetText, Button10, (, GUI Keyboard
ControlSetText, Button11, ), GUI Keyboard
ControlSetText, Button12, _, GUI Keyboard
ControlSetText, Button13, +, GUI Keyboard
ControlSetText, Button14, |, GUI Keyboard
ControlSetText, Button27, {, GUI Keyboard
ControlSetText, Button28, }, GUI Keyboard
ControlSetText, Button40, :, GUI Keyboard
ControlSetText, Button41, ", GUI Keyboard
ControlSetText, Button51, <, GUI Keyboard
ControlSetText, Button52, >, GUI Keyboard
ControlSetText, Button53, ?, GUI Keyboard
Sh:=1
Return

ShiftOff: ;Turn Shift off and Change the Buttons to non shifted state
ControlSetText, Button1, ``, GUI Keyboard
ControlSetText, Button2, 1, GUI Keyboard
ControlSetText, Button3, 2, GUI Keyboard
ControlSetText, Button4, 3, GUI Keyboard
ControlSetText, Button5, 4, GUI Keyboard
ControlSetText, Button6, 5, GUI Keyboard
ControlSetText, Button7, 6, GUI Keyboard
ControlSetText, Button8, 7, GUI Keyboard
ControlSetText, Button9, 8, GUI Keyboard
ControlSetText, Button10, 9, GUI Keyboard
ControlSetText, Button11, 0, GUI Keyboard
ControlSetText, Button12, -, GUI Keyboard
ControlSetText, Button13, =, GUI Keyboard
ControlSetText, Button14, \, GUI Keyboard
ControlSetText, Button27, [, GUI Keyboard
ControlSetText, Button28, ], GUI Keyboard
ControlSetText, Button40, `;, GUI Keyboard
ControlSetText, Button41, ', GUI Keyboard
ControlSetText, Button51, `,, GUI Keyboard
ControlSetText, Button52, ., GUI Keyboard
ControlSetText, Button53, /, GUI Keyboard
Sh:=0
Return
(This is the first code I have posted in Scripts & Functions so be nice)

None
  • Members
  • 3199 posts
  • Last active: Nov 05 2015 09:55 PM
  • Joined: 28 Nov 2009
I have learnd a little since January and thought it would be a good Idea to Post an improved Version :D
SendMode Play ;here you can change the Send Mode, key order, and what shift changes the characters to 
Row1:="1‡2‡3‡4‡5‡6‡7‡8‡9‡0‡-‡=‡\‡Bs"
Row2:="Q‡W‡E‡R‡T‡Y‡U‡I‡O‡P‡[‡]"
Row3:="A‡S‡D‡F‡G‡H‡J‡K‡L‡;‡'"
Row4:="Z‡X‡C‡V‡B‡N‡M‡,‡.‡/"
ShiftAble:="``~‡1!‡[email protected]‡3#‡4$‡5%‡6^‡7&‡8*‡9(‡0)‡-_‡=+‡\|‡[{‡]}‡`;:‡'""‡,<‡.>‡/?"

CoordMode, Mouse, Screen
Menu, Tray, NoStandard 
Menu, Tray, Add, Show Keyboard, ShowMe 
Menu, Tray, Add, Help, HelpMe 
Menu, Tray, Add
Menu, Tray, Add, Exit, ExitScript 
Menu, Tray, Default, Show Keyboard ;Double click on Icon to Show
Menu, Tray, Icon , C:\WINDOWS\system32\main.cpl,8  ;not sure if everybody has this icon but I have it on XpSp3

OnMessage(0x205 , "RightClickCap") ;WM_RBUTTONUP Right to send Caps
OnMessage(0x207 , "MButtonMove") ;WM_MBUTTONDOWN Middle click to move Gui

Caps:=0,Sh:=0 ;Preset Caps and Shift to off
;http://www.autohotkey.com/forum/viewtopic.php?t=62257 thanks Wicked
Gui, +LastFound +AlwaysOnTop +ToolWindow -Caption +Border +E0x08000000 
Gui, Add, Button, x5 y5 w20 h20 gSendP , ``
Loop, Parse, Row1,‡
 Gui, Add, Button, x+2 w20 h20 gSendP , %A_LoopField%
Gui, Add, Button, x5 y27 w30 h20 gSendP, Tab
Loop, Parse, Row2,‡
 Gui, Add, Button, x+2 w20 h20 gSendP , %A_LoopField%
Gui, Add, Button, x+2 w32 h26 gSendA, En ;.
Gui, Add, Button, x5 y49 w40 h20 , Caps
Loop, Parse, Row3,‡
 Gui, Add, Button, x+2 w20 h20 gSendP , %A_LoopField%
Gui, Add, Button, x+2 w44 h20 gSendA, En
Gui, Add, Button, x5 y71 w53 h20 , Shift
Loop, Parse, Row4,‡
 Gui, Add, Button, x+2 w20 h20 gSendP , %A_LoopField%
Gui, Add, Button, x+2 w53 h20 , Shift
Gui, Add, Text, x5 y93 w70 h20 vCapsLabel, CapsLock Off
Gui, Add, Button, x+2 w132 h20 gSendP, Space
Gui, Add, Button, x+2 w20 h20 gSendA , <
Gui, Add, Button, x+2 w20 h20 gSendA , ^
Gui, Add, Button, x+2 w20 h20 gSendA , v
Gui, Add, Button, x+2 w20 h20 gSendA , >
Gui, Add, Button, x+2 h20 , Hide
Pos:=A_ScreenHeight - 135
ShowMe:
Gui, Show,xCenter y%Pos% NoActivate ,GUI Keyboard
Return

SendP: ;sub that sends most keys
If((Caps+Sh)=0) ;check Caps and Shift state
 StringLower, Letter, A_GuiControl ;if off make lower
Else
 StringUpper, Letter, A_GuiControl ;if on make UPPER
ifEqual Sh,1, GoSub ShiftOff ;if shift was on turn it off
Send % (Letter="&&") ? "&" : "{" Letter "}"
Return

SendA: ;sub that sends Arrows and Enter
IfEqual, A_GuiControl, <, Send {Left}
IfEqual, A_GuiControl, ^, Send {Up}
IfEqual, A_GuiControl, v, Send {Down}
IfEqual, A_GuiControl, >, Send {Right}
IfEqual, A_GuiControl, En, Send {Enter}
Return

ButtonCaps: ;Change the Caps state and it's label on the Gui
GuiControl, , CapsLabel, % (Caps:=!Caps) ? "CapsLock On" : "CapsLock Off"
Return

ButtonHide:
Gui, Hide
Return

ButtonShift: ;Turn Shift on and Change the Buttons to shifted state
ShiftOff: ;Turn Shift off and Change the Buttons to non shifted state
Loop, Parse, ShiftAble, ‡
 {
 StringSplit Var, A_LoopField
 If (A_ThisLabel="ButtonShift" && Sh=0)
  GuiControl, , %Var1% , % (Var2="&") ? "&&" : Var2
 Else
   GuiControl, , % (Var2="&") ? "&&" : Var2 , %Var1%
 }
Sh:=(A_ThisLabel="ButtonShift" && Sh=0) ? 1 : 0
Return

HelpMe:
MsgBox,
(
Middle click on the Gui to move

Right click on a letter to send it uppercase
  Bonus Right click does not toggle shift back off

The Shift and Caps Buttons are seperate from the System ones
)
Return

ExitScript:
ExitApp

MButtonMove() {
While GetKeyState("MButton","p") {
 MouseGetPos X,Y
 WinMove, GUI Keyboard,,% X-157 ,% Y-60
 }
}

RightClickCap()
{
MouseGetPos,,,,Control
ControlGetText, Text, %Control%
If (StrLen(Text)=1 || Text="&&")
 {
 StringUpper, Letter, Text
 Send % (Letter="&&") ? "&" : "{" Letter "}"
 }
}
Edit:Forgot the shifted 5
Edit 2: Added Code so the & would show on 7 when shifted
Made Shift into a Toggle
Added a Hotkey to move the Gui "MButton & RButton" while you are holding the middle button the gui follows the mouse
Edit 3: by special reqeust of OSK lover I added Right click for CAPS (Great idea)
In thinking about how to add the Right clicks I saw a better way to move it also so now the move is just Middle click and hold
Addd a little bit of help about the mouse buttons and Shift/Caps buttons

  • Guests
  • Last active:
  • Joined: --
very nice

Wicked - Guest
  • Guests
  • Last active:
  • Joined: --
Haha! That is too cool!

The one thing I hate about that GUI style though is that when you click and drag the title bar to move the window, the window itself doesn't move until you release the mouse button. I've been toying around with fixing it with OnMessage though. I might try right now to see if I can get it to work with SKAN's How to enable Drag for a GUI without a Titlebar ?.

On a different note, I absolutely love the mini keyboard, the controls, and your way of building it. The only thing I could say to improve would be that the caps lock doesn't seem to work. A second thing would be to make shift more like a toggle, so to speak. For example, I click the shift, change my mind and need lower case again. Currently there's no way to disable shift once it's been pushed except clicking a key. Sorry if that made no sense. :p.

I like it. :D.

Wicked - Guest
  • Guests
  • Last active:
  • Joined: --
About SKAN's method of using PostMessage for a better method of moving the window... Doesn't work. Gonna figure something out to fix it tonight. :).

None
  • Members
  • 3199 posts
  • Last active: Nov 05 2015 09:55 PM
  • Joined: 28 Nov 2009

the caps lock doesn't seem to work.

The Shift and Capslock are local to the Gui and are not affected by the computers Capslock or Shift.

I have updated it to make shift toggle (Yea that was kind of annoyong)
And added a Hotkey for moving the gui (and eliminated the title bar :) )
To move Hold Middle press Right and the gui Should follow the mouse till you let go of the Middle button.

Chicken Pie 4 Tea
  • Members
  • 379 posts
  • Last active: Dec 12 2014 06:46 PM
  • Joined: 18 Aug 2009

the caps lock doesn't seem to work.

The Shift and Capslock are local to the Gui and are not affected by the computers Capslock or Shift.

I have updated it to make shift toggle (Yea that was kind of annoyong)
And added a Hotkey for moving the gui (and eliminated the title bar :) )
To move Hold Middle press Right and the gui Should follow the mouse till you let go of the Middle button.


Which one have you updated the first post or the second, I guess its the second. Yes i see now you have added "edit..." below the code box.
question, why the empty keys between keys? eg there is A then two empty keys then S etc.
"Choose your parents wisely"

OSK lover
  • Guests
  • Last active:
  • Joined: --
Almost perfect for me :)

If you could jsut get the RIGHT-CLICK to be CAPITALS - like:
http://cnt.lakefolks.com/

Then it would be my favorite app :)

None
  • Members
  • 3199 posts
  • Last active: Nov 05 2015 09:55 PM
  • Joined: 28 Nov 2009

If you could jsut get the RIGHT-CLICK to be CAPITALS

Wish granted :)

question, why the empty keys between keys? eg there is A then two empty keys then S etc.

I don't have blank buttons :? What OS/Ahk Version are you using? (I have only tested it on XP with Vanila AHk)

Chicken Pie 4 Tea
  • Members
  • 379 posts
  • Last active: Dec 12 2014 06:46 PM
  • Joined: 18 Aug 2009
XP(sp2) ahk 1.0.48.05
I have 2 empty keys between each key eg q then 2 empty then w etc.
"Choose your parents wisely"

None
  • Members
  • 3199 posts
  • Last active: Nov 05 2015 09:55 PM
  • Joined: 28 Nov 2009
I just duplicated your problem by saving in UTF-8 Encoding try saving in ANSI.

OSK lover
  • Guests
  • Last active:
  • Joined: --
Nice!

Chicken Pie 4 Tea
  • Members
  • 379 posts
  • Last active: Dec 12 2014 06:46 PM
  • Joined: 18 Aug 2009
@None Yes I saved it using notepad and its fine. I started using notepad2 a while ago and usually just just choose "save as type" for all scripts. I'll switch back to good old notepad!
"Choose your parents wisely"