Jump to content

Keyboard Simulator


Kreatorul
 Share

Recommended Posts

Keyboard Simulator made in Autoit similar to the windows one!

Many 10x to lod3n

#include <GUIConstants.au3>
Opt("GUIOnEventMode", 1)  ; Change to OnEvent mode

Global $shiftT = 0
Global $ctrlT = 0
Global $WinT = 0
Global $AltT = 0
Global $WS_EX_NOACTIVATE = 0x8000000


$gui = GUICreate("Keyboard Simulator", 570, 195, 210, 348, -1, $WS_EX_NOACTIVATE + $WS_EX_TOOLWINDOW)
GUISetBkColor(0xE0FFFF)
$Tab1 = GUICtrlCreateTab(0, 0, 580, 215)
$TabSheet1 = GUICtrlCreateTabItem("Keyboard")
$Esc = GUICtrlCreateButton("Esc", 5, 30, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$F1 = GUICtrlCreateButton("F1", 45, 30, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$F2 = GUICtrlCreateButton("F2", 69, 30, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$F3 = GUICtrlCreateButton("F3", 93, 30, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$F4 = GUICtrlCreateButton("F4", 117, 30, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$F5 = GUICtrlCreateButton("F5", 157, 30, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$F6 = GUICtrlCreateButton("F6", 181, 30, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$F7 = GUICtrlCreateButton("F7", 205, 30, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$F8 = GUICtrlCreateButton("F8", 229, 30, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$F9 = GUICtrlCreateButton("F9", 269, 30, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$F10 = GUICtrlCreateButton("F10", 293, 30, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$F11 = GUICtrlCreateButton("F11", 317, 30, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$F12 = GUICtrlCreateButton("F12", 341, 30, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$Print = GUICtrlCreateButton("PSc", 381, 30, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$Scroll = GUICtrlCreateButton("ScL", 405, 30, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$pause = GUICtrlCreateButton("PBr", 429, 30, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$cr = GUICtrlCreateButton("` ~", 5, 70, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$b1 = GUICtrlCreateButton("1 !", 29, 70, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$b2 = GUICtrlCreateButton("2 @", 53, 70, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$b3 = GUICtrlCreateButton("3 #", 77, 70, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$b4 = GUICtrlCreateButton("4 $", 101, 70, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$b5 = GUICtrlCreateButton("5 %", 125, 70, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$b6 = GUICtrlCreateButton("6 ^", 149, 70, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$b7 = GUICtrlCreateButton("7 &", 173, 70, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$b8 = GUICtrlCreateButton("8 *", 197, 70, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$b9 = GUICtrlCreateButton("9 (", 221, 70, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$b0 = GUICtrlCreateButton("0 )", 245, 70, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$bl = GUICtrlCreateButton("- _", 269, 70, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$bpl = GUICtrlCreateButton("= +", 293, 70, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$bl2 = GUICtrlCreateButton("\ |", 317, 70, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$bk = GUICtrlCreateButton("<---", 341, 70, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$ins = GUICtrlCreateButton("Ins", 381, 70, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$ho = GUICtrlCreateButton("Ho", 405, 70, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$pgu = GUICtrlCreateButton("PgU", 429, 70, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$del = GUICtrlCreateButton("Del", 381, 94, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$end = GUICtrlCreateButton("End", 405, 94, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$PgD = GUICtrlCreateButton("PgD", 429, 94, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$tab = GUICtrlCreateButton("Tab", 5, 94, 33, 25)
GUICtrlSetOnEvent(-1, "type")
$Q = GUICtrlCreateButton("Q", 37, 94, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$W = GUICtrlCreateButton("W", 61, 94, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$E = GUICtrlCreateButton("E", 85, 94, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$R = GUICtrlCreateButton("R", 109, 94, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$T = GUICtrlCreateButton("T", 133, 94, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$Y = GUICtrlCreateButton("Y", 157, 94, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$U = GUICtrlCreateButton("U", 181, 94, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$I = GUICtrlCreateButton("I", 205, 94, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$O = GUICtrlCreateButton("O", 229, 94, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$p = GUICtrlCreateButton("P", 253, 94, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$bp = GUICtrlCreateButton("[ {", 277, 94, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$bp2 = GUICtrlCreateButton("] }", 301, 94, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$enter1 = GUICtrlCreateButton("Enter", 325, 94, 41, 25)
GUICtrlSetOnEvent(-1, "type")
$caps = GUICtrlCreateButton("Caps", 5, 118, 41, 25)
GUICtrlSetOnEvent(-1, "toggle")
$A = GUICtrlCreateButton("A", 45, 118, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$ButtonS = GUICtrlCreateButton("S", 69, 118, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$ButtonD = GUICtrlCreateButton("D", 93, 118, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$ButtonF = GUICtrlCreateButton("F", 117, 118, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$G = GUICtrlCreateButton("G", 141, 118, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$H = GUICtrlCreateButton("H", 165, 118, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$J = GUICtrlCreateButton("J", 189, 118, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$K = GUICtrlCreateButton("K", 213, 118, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$L = GUICtrlCreateButton("L", 237, 118, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$bpsv = GUICtrlCreateButton("; :", 261, 118, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$bcrt = GUICtrlCreateButton("' ''", 285, 118, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$enter = GUICtrlCreateButton("Enter", 309, 118, 57, 25)
GUICtrlSetOnEvent(-1, "type")
$Shift = GUICtrlCreateButton("Shift", 5, 142, 57, 25)
GUICtrlSetOnEvent(-1, "toggle")
$Z = GUICtrlCreateButton("Z", 61, 142, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$X = GUICtrlCreateButton("X", 85, 142, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$C = GUICtrlCreateButton("C", 109, 142, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$V = GUICtrlCreateButton("V", 133, 142, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$B = GUICtrlCreateButton("B", 157, 142, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$n = GUICtrlCreateButton("N", 181, 142, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$m = GUICtrlCreateButton("M", 205, 142, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$bvir = GUICtrlCreateButton(", <", 229, 142, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$bpu = GUICtrlCreateButton(". >", 253, 142, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$bpl2 = GUICtrlCreateButton("/ ?", 277, 142, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$shift1 = GUICtrlCreateButton("Shift", 301, 142, 65, 25)
GUICtrlSetOnEvent(-1, "toggle")
$ctrl = GUICtrlCreateButton("Ctrl", 5, 166, 33, 25)
GUICtrlSetOnEvent(-1, "toggle")
$Win = GUICtrlCreateButton("Win", 37, 166, 33, 25)
GUICtrlSetOnEvent(-1, "toggle")
$Alt = GUICtrlCreateButton("Alt", 69, 166, 33, 25)
GUICtrlSetOnEvent(-1, "toggle")
$Ctrl1 = GUICtrlCreateButton("Ctrl", 333, 166, 33, 25)
GUICtrlSetOnEvent(-1, "toggle")
$win2 = GUICtrlCreateButton("Win", 301, 166, 33, 25)
GUICtrlSetOnEvent(-1, "toggle")
$alt1 = GUICtrlCreateButton("Alt", 269, 166, 33, 25)
GUICtrlSetOnEvent(-1, "toggle")
$space = GUICtrlCreateButton("Space", 101, 166, 169, 25)
GUICtrlSetOnEvent(-1, "type")
$left = GUICtrlCreateButton("<--", 381, 166, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$up = GUICtrlCreateButton("/\", 405, 142, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$down = GUICtrlCreateButton("\/", 405, 166, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$right = GUICtrlCreateButton("-->", 429, 166, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$num = GUICtrlCreateButton("Num", 469, 70, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$bld = GUICtrlCreateButton("/", 493, 70, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$bst = GUICtrlCreateButton("*", 517, 70, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$mm = GUICtrlCreateButton("-", 541, 70, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$b77 = GUICtrlCreateButton("7", 469, 94, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$b88 = GUICtrlCreateButton("8", 493, 94, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$b99 = GUICtrlCreateButton("9", 517, 94, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$B44 = GUICtrlCreateButton("4", 469, 118, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$b55 = GUICtrlCreateButton("5", 493, 118, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$b66 = GUICtrlCreateButton("6", 517, 118, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$b11 = GUICtrlCreateButton("1", 469, 142, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$b22 = GUICtrlCreateButton("2", 493, 142, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$b33 = GUICtrlCreateButton("3", 517, 142, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$Button24 = GUICtrlCreateButton("0", 469, 166, 49, 25)
GUICtrlSetOnEvent(-1, "type")
$Bpp = GUICtrlCreateButton(".", 517, 166, 25, 25)
GUICtrlSetOnEvent(-1, "type")
$Bplus = GUICtrlCreateButton("+", 541, 94, 25, 49)
GUICtrlSetOnEvent(-1, "type")
$benter = GUICtrlCreateButton("Ent", 541, 142, 25, 49)
GUICtrlSetOnEvent(-1, "type")
GUISetOnEvent($GUI_EVENT_CLOSE, "terminate")
$TabSheet2 = GUICtrlCreateTabItem("Media")
$open = GUICtrlCreateButton("Open Media Player", 9, 32, 105, 25)
GUICtrlSetOnEvent(-1, "type")
$volm = GUICtrlCreateButton("Vol -", 137, 32, 49, 25)
GUICtrlSetOnEvent(-1, "type")
$volp = GUICtrlCreateButton("Vol +", 185, 32, 49, 25)
GUICtrlSetOnEvent(-1, "type")
$mute = GUICtrlCreateButton("Mute", 241, 32, 41, 25)
GUICtrlSetOnEvent(-1, "type")
$mstop = GUICtrlCreateButton("Stop", 241, 64, 41, 25)
GUICtrlSetOnEvent(-1, "type")
$play = GUICtrlCreateButton("Play/Pause", 9, 64, 105, 25)
GUICtrlSetOnEvent(-1, "type")
$prevs = GUICtrlCreateButton("<---Song", 137, 64, 49, 25)
GUICtrlSetOnEvent(-1, "type")
$nexts = GUICtrlCreateButton("Song--->", 185, 64, 49, 25)
GUICtrlSetOnEvent(-1, "type")
$TabSheet3 = GUICtrlCreateTabItem("Internet")
$openb = GUICtrlCreateButton("Open Browser", 9, 32, 105, 25)
GUICtrlSetOnEvent(-1, "type")
$fav = GUICtrlCreateButton("Fav", 137, 32, 49, 25)
GUICtrlSetOnEvent(-1, "type")
$refresh = GUICtrlCreateButton("Refresh", 185, 32, 49, 25)
GUICtrlSetOnEvent(-1, "type")
$search = GUICtrlCreateButton("Search", 241, 32, 41, 25)
GUICtrlSetOnEvent(-1, "type")
$stop = GUICtrlCreateButton("Stop", 241, 64, 41, 25)
GUICtrlSetOnEvent(-1, "type")
$openm = GUICtrlCreateButton("Open Mail", 9, 64, 105, 25)
GUICtrlSetOnEvent(-1, "type")
$back = GUICtrlCreateButton("Back", 137, 64, 49, 25)
GUICtrlSetOnEvent(-1, "type")
$forward = GUICtrlCreateButton("Forward", 185, 64, 49, 25)
GUICtrlSetOnEvent(-1, "type")

GUISetState(@SW_SHOW)
WinSetOnTop($gui, "", 1)

While 1
    Sleep(1000)   ; Just idle around
WEnd


Func terminate()
    Exit
EndFunc   ;==>terminate


Func toggle()
    ConsoleWrite("toggle" & @CRLF)
    Switch @GUI_CtrlId
        Case $caps
            $shiftT = Not $shiftT
        Case $Shift
            $shiftT = Not $shiftT
        Case $shift1
            $shiftT = Not $shiftT
        Case $ctrl
            $ctrlT = Not $ctrlT
        Case $Win
            $WinT = Not $WinT
        Case $Alt
            $AltT = Not $AltT
        Case $Ctrl1
            $ctrlT = Not $ctrlT
        Case $win2
            $WinT = Not $WinT
        Case $alt1
            $AltT = Not $AltT
    EndSwitch
EndFunc   ;==>toggle


Func type()
    Switch @GUI_CtrlId
        Case $A
            keysend("a")
        Case $B
            keysend("b")
        Case $C
            keysend("c")
        Case $ButtonD
            keysend("d")
        Case $E
            keysend("e")
        Case $ButtonF
            keysend("f")
        Case $G
            keysend("g")
        Case $H
            keysend("h")
        Case $I
            keysend("i")
        Case $C
            keysend("i")
        Case $J
            keysend("j")
        Case $K
            keysend("k")
        Case $L
            keysend("l")
        Case $m
            keysend("m")
        Case $n
            keysend("n")
        Case $O
            keysend("o")
        Case $p
            keysend("p")
        Case $Q
            keysend("q")
        Case $R
            keysend("r")
        Case $ButtonS
            keysend("s")
        Case $T
            keysend("t")
        Case $U
            keysend("u")
        Case $V
            keysend("v")
        Case $X
            keysend("x")
        Case $cr
            keysend("`")
        Case $Y
            keysend("y")
        Case $Z
            keysend("z")
        Case $W
            keysend("w")
        Case $space
            keysend(" ")
        Case $b1
            keysend("1")
        Case $b2
            keysend("2")
        Case $b3
            keysend("3")
        Case $b4
            keysend("4")
        Case $b5
            keysend("5")
        Case $b6
            keysend("6")
        Case $b7
            keysend("7")
        Case $b8
            keysend("8")
        Case $b9
            keysend("9")
        Case $b0
            keysend("0")
        Case $bl
            keysend("-")
        Case $b11
            keysend("{NUMPAD1}")
        Case $b22
            keysend("{NUMPAD2}")
        Case $b33
            keysend("{NUMPAD3}")
        Case $B44
            keysend("{NUMPAD4}")
        Case $b55
            keysend("{NUMPAD5}")
        Case $b66
            keysend("{NUMPAD6}")
        Case $b77
            keysend("{NUMPAD7}")
        Case $b88
            keysend("{NUMPAD8}")
        Case $b99
            keysend("{NUMPAD9}")
        Case $Button24
            keysend("{NUMPAD0}")
        Case $bst
            keysend("{NUMPADMULT}")
        Case $bld
            keysend("{NUMPADDIV}")
        Case $Bplus
            keysend("{NUMPADADD}")
        Case $mm
            keysend("{NUMPADSUB}")
        Case $Bpp
            keysend("{NUMPADDOT}")
        Case $num
            keysend("{NUMLOCK}")
        Case $bpl
            keysend("=")
        Case $Print
            keysend("{PRINTSCREEN}")
        Case $Scroll
            keysend("{SCROLLLOCK toggle}")
        Case $pgu
            keysend("{PGUP}")
        Case $PgD
            keysend("{PGDN}")
        Case $caps
            keysend("{CAPSLOCK}")
        Case $benter
            keysend("{NUMPADENTER}")
        Case $del
            keysend("{DEL}")
        Case $ins
            keysend("{INS}")
        Case $end
            keysend("{END}")
        Case $bpl
            keysend("=")
        Case $ho
            keysend("{HOME}")
        Case $bk
            keysend("{BACKSPACE}")
        Case $bl2
            keysend("\")
        Case $tab
            keysend("{TAB}")
        Case $Shift
            keysend("{LSHiFT}")
        Case $shift1
            keysend("{RSHiFT}")
        Case $ctrl
            keysend("{LCTRL}")
        Case $Ctrl1
            keysend("{RCTRL}")
        Case $Win
            keysend("{LWin}")
        Case $win2
            keysend("{rWin}")
        Case $Alt
            keysend("{Lalt}")
        Case $alt1
            keysend("{RAlt}")
        Case $bp
            keysend("[")
        Case $bp2
            keysend("]")
        Case $enter
            keysend("{ENTER}")
        Case $enter1
            keysend("{ENTER}")
        Case $bpsv
            keysend(";")
        Case $bvir
            keysend(",")
        Case $bcrt
            keysend("'")
        Case $bpu
            keysend(".")
        Case $bpl2
            keysend("/")
        Case $right
            keysend("{right}")
        Case $left
            keysend("{left}")
        Case $up
            keysend("{up}")
        Case $down
            keysend("{down}")
        Case $Esc
            keysend("{ESC}")
        Case $F1
            keysend("{F1}")
        Case $F2
            keysend("{F2}")
        Case $F3
            keysend("{F3}")
        Case $F4
            keysend("{F4}")
        Case $F5
            keysend("{F5}")
        Case $F6
            keysend("{F6}")
        Case $F7
            keysend("{F7}")
        Case $F8
            keysend("{F8}")
        Case $F9
            keysend("{F9}")
        Case $F10
            keysend("{F10}")
        Case $F11
            keysend("{F11}")
        Case $F12
            keysend("{F12}")
        Case $open
            keysend("{LAUNCH_MEDIA}")
        Case $prevs
            keysend("{MEDIA_PREV}")
        Case $nexts
            keysend("{MEDIA_NEXT}")
        Case $mute
            keysend("{VOLUME_MUTE}")
        Case $volp
            keysend("{VOLUME_UP}")
        Case $volm
            keysend("{VOLUME_DOWN}")
        Case $mstop
            keysend("{MEDIA_STOP}")
        Case $play
            keysend("{MEDIA_PLAY_PAUSE}")
        Case $openm
            keysend("{LAUNCH_MAIL}")
        Case $openb
            keysend("{BROWSER_HOME}")
        Case $fav
            keysend("{BROWSER_FAVORITES}")
        Case $refresh
            keysend("{BROWSER_REFRESH}")
        Case $search
            keysend("{BROWSER_SEARCH}")
        Case $back
            keysend("{BROWSER_BACK}")
        Case $forward
            keysend("{BROWSER_FORWARD}")
        Case $stop
            keysend("{BROWSER_STOP}")
    EndSwitch
EndFunc   ;==>type

Func keysend($chars)
    If $shiftT = 1 Then $chars = "+" & $chars
    If $ctrlT = 1 Then $chars = "^" & $chars
    If $WinT = 1 Or $WinT = 1 Then $chars = "#" & $chars
    If $AltT = 1 Then $chars = "!" & $chars
    
    Send($chars)
EndFunc   ;==>keysend
Link to comment
Share on other sites

Nice job...

You may be able to get some info from this

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt("GUIOnEventMode", 1)

Dim $BTN_[37]
Dim $NBTN_[10]
Dim $x
Dim $ver = "1.0.1"
Dim $left = 0
Dim $top = 0
$key = StringSplit("1,2,3,4,5,6,7,8,9,0,Q,W,E,R,T,Y,U,I,O,P,A,S,D,F,G,H,J,K,L,Z,X,C,V,B,N,M", ",")

$mainwindow = GUICreate("Keyboard - Enter Your PIN Number", 545, 200, 20, @DesktopHeight - 300)

; BUTTONS
For $i = 1 To 36
    $BTN_[$i] = GUICtrlCreateButton($key[$i], $left, $top, 40, 40)
    GUICtrlSetOnEvent($BTN_[$i], "ButtonPressed")
    $left = $left + 40
    If $i = 10 Or $i = 20 Or $i = 29 Then $top = $top + 40
    If $i = 10 Then $left = 0
    If $i = 20 Then $left = 20
    If $i = 29 Then $left = 40
Next

$BackSpace = GUICtrlCreateButton("<-", 320, 120, 40, 40)
GUICtrlSetFont(-1, 10, 500)
$Input = GUICtrlCreateInput("", 40, 170, 150, 20)
GUICtrlSetFont(-1, 10)
$Send = GUICtrlCreateButton("&ENTER", 205, 165, 150, 30)
GUICtrlSetOnEvent($BackSpace, "Back_Space")
GUICtrlSetOnEvent($Send, "Send_it")
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
GUISetState(@SW_SHOW)

GUICreate("Pass", 142, 198, 405, 0, BitOR($WS_CHILD, $WS_TABSTOP) + $WS_DLGFRAME, -1, $mainwindow)
$Num = StringSplit("1,2,3,4,5,6,7,8,9", ",")
$n = 1
$NBTN_[$n] = GUICtrlCreateButton("1", 10, 20, 40, 40)
GUICtrlSetOnEvent(-1, "Set_Num")
$n = $n + 1
$NBTN_[$n] = GUICtrlCreateButton("2", 50, 20, 40, 40)
GUICtrlSetOnEvent(-1, "Set_Num")
$n = $n + 1
$NBTN_[$n] = GUICtrlCreateButton("3", 90, 20, 40, 40)
GUICtrlSetOnEvent(-1, "Set_Num")
$n = $n + 1
$NBTN_[$n] = GUICtrlCreateButton("4", 10, 60, 40, 40)
GUICtrlSetOnEvent(-1, "Set_Num")
$n = $n + 1
$NBTN_[$n] = GUICtrlCreateButton("5", 50, 60, 40, 40)
GUICtrlSetOnEvent(-1, "Set_Num")
$n = $n + 1
$NBTN_[$n] = GUICtrlCreateButton("6", 90, 60, 40, 40)
GUICtrlSetOnEvent(-1, "Set_Num")
$n = $n + 1
$NBTN_[$n] = GUICtrlCreateButton("7", 10, 100, 40, 40)
GUICtrlSetOnEvent(-1, "Set_Num")
$n = $n + 1
$NBTN_[$n] = GUICtrlCreateButton("8", 50, 100, 40, 40)
GUICtrlSetOnEvent(-1, "Set_Num")
$n = $n + 1
$NBTN_[$n] = GUICtrlCreateButton("9", 90, 100, 40, 40)
GUICtrlSetOnEvent(-1, "Set_Num")

$button_reset = GUICtrlCreateButton("Reset", 0, 0, 40, 20)
GUICtrlSetOnEvent(-1, "Reset")
$Send2 = GUICtrlCreateButton("Enter", 10, 140, 120, 30)
GUICtrlSetOnEvent(-1, "Send_it")
$Label_11 = GUICtrlCreateLabel("Please Enter Password", 10, 170, 110, 20)
$pass = 0
GUISetState()

While (1)
    Sleep(20)
WEnd

Func Show_keys()
    GUISetState(@SW_SHOW, $mainwindow)
EndFunc   ;==>Show_keys

Func ButtonPressed()
    $i = @GUI_CtrlId - $BTN_[1] + 1; array starts at item 1, so add 1
    $info1 = GUICtrlRead($Input)
    GUICtrlSetData($Input, $info1 & $key[$i])
EndFunc   ;==>ButtonPressed

Func Set_Num()
    $n = @GUI_CtrlId - $NBTN_[1] + 1; array starts at item 1, so add 1
    $info1 = GUICtrlRead($Input)
    GUICtrlSetData($Input, $info1 & $key[$n])
EndFunc   ;==>Set_Num

Func Back_Space()
    $info1 = GUICtrlRead($Input)
    $info1 = StringTrimRight($info1, 1)
    GUICtrlSetData($Input, $info1)
EndFunc   ;==>Back_Space

Func CLOSEClicked()
    If @GUI_WinHandle = $mainwindow Then
        Exit
    EndIf
EndFunc   ;==>CLOSEClicked

Func Send_it()
    MsgBox(0, "", GUICtrlRead($Input))
EndFunc   ;==>Send_it

Func Reset()
    GUICtrlSetData($Input, "")
EndFunc   ;==>Reset

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

This keyboard simulator works really well. Good work Kreatorul

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Link to comment
Share on other sites

This code is very intresting and it works well. I prefere the Valuater way to write the code.

Anyway how can i use localized version of the keyboard ?

I need French (belgium) keyboard but i guest the best way is to check what keyboard Windows use and simply map it with this code.

Also i can't use the shifted keys like @# etc... can anyone try and tell me

Thanks

Link to comment
Share on other sites

The shifted keys work fine with me...lod3n done that part and it works :)

Does i need to run it with the beta of AutoIt ?

Anyway thank you for this code that help me for a problem i have actually.

I will modify it to map a belgian keyboard (the use of the windows keyboard was not a good idea)

Link to comment
Share on other sites

Ahh, cool! You posted the finished version. Good work on all of the typing!

I was thinking it might have been better to use the built in Send "Toggle" functions for capslock, numlock and scrolllock, for instance:

Case $caps

keysend("{CAPSLOCK toggle}")

[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

Link to comment
Share on other sites

Ahh, cool! You posted the finished version. Good work on all of the typing!

I was thinking it might have been better to use the built in Send "Toggle" functions for capslock, numlock and scrolllock, for instance:

Case $caps

keysend("{CAPSLOCK toggle}")

Hi,

I found why the shifted keys are not working for me.

Our keyboard are different so when you want to send a "@" it's SHIFT+2 on your american keyboard but on our keyboard i need to send ALT-GR+é to get the "@".

I checked the AutoIt help but i can't find the character to use for the ALT-GR key. I tried the "!" but it does'nt work simply because if i press ALT+é it does nothing.

What char could i use to simulate ALT-GR keypress ?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...