Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn ; Enable warnings to assist with detecting common errors.
#SingleInstance, Force
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
Menu, Tray, Icon, n.ico ; Menu and Tray Icon
;Keyboard layout: [key name, width, spacing]
OSK()
OSK() {
static NewName:={"🢀":"BS", "✖":"Delete" }
w1:=40, h1:=25
s1:=[["🢀",w1-22],["✖",w1-22],["Enter",w1] ]
s2:=[["Tab",w1-8],["Space",w1+6]]
s3:=[["Esc",w1-10],["Shift",w1*1.2]]
s4:=[["Ctrl",w1],["Alt",w1]]
Gui, OSK: Destroy
; +E0x08000000 Click not to activate
Gui, OSK: +AlwaysOnTop +Owner +E0x08000000
Gui, OSK: Font, s10, Verdana
Gui, OSK: Margin, 0, 0
Gui, OSK: Color, DDEEFF
Loop, 4 {
if (A_Index<=2)
j=
For i,v in s%A_Index%
{
w:=v.2 ? v.2 : w1, d:=v.3 ? v.3 : 2
j:=j="" ? "xm" : i=1 ? "xm y+2" : "x+" d
Gui, OSK: Add, Button, %j% w%w% h%h1% -Wrap gRunOSK, % v.1
}
}
Gui, OSK: Show, NA, NKey
return
OSKGuiClose:
Gui, OSK: Minimize
return
RunOSK:
k:=A_GuiControl
s:=InStr(k," ") ? SubStr(k,0) : k
s:=(v:=NewName[s]) ? v : s, s:="{" s "}"
If A_GuiControl in Shift,Ctrl,Alt,Space
Send % "{" A_GuiControl " " (GetKeyState(A_GuiControl) ? "up" : "down") "}"
Else SendInput, {Blind}%s%
return
}
Link: https://www.autohotkey.com/boards/viewtopic.php?f=6&t=58366
Code and Image Updated.
Solved