Jump to content

My Virtual Keyboard


Info
 Share

Recommended Posts

I'm not a type of a programmer, so I have to ask here. If anyone here can write an example script for a macro.

The macro should be, if I press and hold down the button of example X button on my keyboard, the macro should press X in infinite loop untill I don't press down X button anymore. The speed of press X should be adjustable.

I would be grateful if anyone can write a script.

Link to comment
Share on other sites

I'm not a type of a programmer, so I have to ask here. If anyone here can write an example script for a macro.

The macro should be, if I press and hold down the button of example X button on my keyboard, the macro should press X in infinite loop untill I don't press down X button anymore. The speed of press X should be adjustable.

I would be grateful if anyone can write a script.

Your asking in the wrong place.

#include <Misc.au3>
#include <String.au3>

Dim $Speed = 500 ; In milliseconds
Dim $Key = 70 ; Refer to Helpfile for _IsPressed

While 1
    While(_IsPressed(70))
        Send(_HexToString($Key))
        Sleep($Speed)
    WEnd
    Sleep(50)
Wend

Not tested, don't even think it will work...

Link to comment
Share on other sites

I'm not a type of a programmer, so I have to ask here. If anyone here can write an example script for a macro.

The macro should be, if I press and hold down the button of example X button on my keyboard, the macro should press X in infinite loop untill I don't press down X button anymore. The speed of press X should be adjustable.

I would be grateful if anyone can write a script.

Wait... don't keyboards do this by default?

Link to comment
Share on other sites

I had turned Scroll Lock on and then closed the program,

but on my keyboard i dont have scroll lock so you have to add

when exit that all functions turn off

And if i have program on and i press num lock on my real keyboard the virtual keyboard stays off

Edited by wipped
Link to comment
Share on other sites

I like this and have some use for it... About that line of code...

I think this would be more correct:

WinActivate($ReplacedString)

If WinActive($ReplacedString) Then Send($_Key)

This will try to activate the window and then check if it's active and if it is, act accordingly.

If you use:

If WinActivate($ReplacedString) Then Send($_Key)

It tries to activate that window and returns 1 if it does or 0 if it can't find the window or can't activate it. This doesn't check if the window is actually active so it may not be, basically if you use it this way some other window may have taken focus (another program maybe) before the Send() function has been called.

This is how I've understood it anyway...

Edited by AoRaToS

s!mpL3 LAN Messenger

Current version 2.9.9.1 [04/07/2019]

s!mpL3 LAN Messenger.zip

s!mpL3

Link to comment
Share on other sites

  • 2 weeks later...

Wait... don't keyboards do this by default?

Normally it does by default if you typing text or something. But it won't work on a game. Let's say for example you have to press X to attack and if you press down & hold X, the game will ONLY allow you to attack once because for constant attacking you MUST press X every time. that's why I would like a macro that do it for me. constantly pressing X for hours hurts fingers if you have to. :)

Edited by oyyzj
Link to comment
Share on other sites

  • 1 month later...

@info

Hello

I like your virtual keybord.It's very good. I did some changes in your script: Qwerty > Azerty because I'm not using a qwerty keyboard.µ

here is the code:

#include <ButtonConstants.au3>

#include <GUIConstantsEx.au3>

#include <WindowsConstants.au3>

#include <StaticConstants.au3>

Opt("WinWaitDelay",0)

Opt("SendKeyDelay",0)

Opt("SendKeyDownDelay",0)

Opt("Sendcapslockmode",0)

Opt("TrayIconHide",1)

Opt("GUICloseOnESC",0)

Global $fLeftShiftHolden = False

Global $fLeftAltHolden = False

Global $fLeftCtrlHolden = False

Global $fRightShiftHolden = False

Global $fRightAltHolden = False

Global $fRightCtrlHolden = False

Global Const $VK_NUMLOCK = 0x90

Global Const $VK_SCROLL = 0x91

Global Const $VK_CAPITAL = 0x14

;HotKeySet("{Esc}","Quit")

Func _NumberLockPushed()

If $NumberLockOn = True Then

GUICtrlSetState($NumberLockOnPic, $GUI_HIDE)

PressButton("{NumLock}",1)

$NumberLockOn = False

Else

GUICtrlSetState($NumberLockOnPic, $GUI_SHOW)

PressButton("{NumLock}",1)

$NumberLockOn = True

EndIf

EndFunc

Func _ScrollLockPushed()

If $ScrollLockOn = True Then

GUICtrlSetState($ScrollLockOnPic, $GUI_HIDE)

PressButton("{ScrollLock}",1)

$ScrollLockOn = False

Else

GUICtrlSetState($ScrollLockOnPic, $GUI_SHOW)

PressButton("{ScrollLock}",1)

$ScrollLockOn = True

EndIf

EndFunc

Func _CapsLockPushed()

If $CapsLockOn = True Then

GUICtrlSetState($CapsLockOnPic, $GUI_HIDE)

PressButton("{CapsLock}",1)

$CapsLockOn = False

Else

GUICtrlSetState($CapsLockOnPic, $GUI_SHOW)

PressButton("{CapsLock}",1)

$CapsLockOn = True

EndIf

EndFunc

$ProductVersion = "v0.1"

$MainGUITitle = "Virtual Keyboard "&$ProductVersion&" Azerty - "

$Form1 = GUICreate($MainGUITitle, 722, 194, 300, 300, -1, BitOR($WS_EX_TOOLWINDOW,$WS_EX_TOPMOST,$WS_EX_WINDOWEDGE))

$Esc = GUICtrlCreateButton("Esc", 0, 0, 33, 25, $WS_GROUP)

$F1 = GUICtrlCreateButton("F1", 48, 0, 33, 25, $WS_GROUP)

$F2 = GUICtrlCreateButton("F2", 80, 0, 33, 25, $WS_GROUP)

$F3 = GUICtrlCreateButton("F3", 112, 0, 33, 25, $WS_GROUP)

$F4 = GUICtrlCreateButton("F4", 144, 0, 33, 25, $WS_GROUP)

$F5 = GUICtrlCreateButton("F5", 184, 0, 33, 25, $WS_GROUP)

$F6 = GUICtrlCreateButton("F6", 216, 0, 33, 25, $WS_GROUP)

$F7 = GUICtrlCreateButton("F7", 248, 0, 33, 25, $WS_GROUP)

$F8 = GUICtrlCreateButton("F8", 280, 0, 33, 25, $WS_GROUP)

$F9 = GUICtrlCreateButton("F9", 320, 0, 33, 25, $WS_GROUP)

$F10 = GUICtrlCreateButton("F10", 352, 0, 33, 25, $WS_GROUP)

$F11 = GUICtrlCreateButton("F11", 385, 0, 33, 25, $WS_GROUP)

$F12 = GUICtrlCreateButton("F12", 417, 0, 33, 25, $WS_GROUP)

$PrintScreen = GUICtrlCreateButton("prtscr", 488, 0, 33, 25, $WS_GROUP)

$ScrollLock = GUICtrlCreateButton("scr lo", 520, 0, 33, 25, $WS_GROUP)

$PauseBreak = GUICtrlCreateButton("pa br", 552, 0, 33, 25, $WS_GROUP)

$Igel = GUICtrlCreateButton("`", 0, 32, 33, 33, $WS_GROUP)

$One = GUICtrlCreateButton("1", 32, 32, 33, 33, $WS_GROUP)

$Two = GUICtrlCreateButton("2", 64, 32, 33, 33, $WS_GROUP)

$Three = GUICtrlCreateButton("3", 96, 32, 33, 33, $WS_GROUP)

$Four = GUICtrlCreateButton("4", 128, 32, 33, 33, $WS_GROUP)

$Five = GUICtrlCreateButton("5", 160, 32, 33, 33, $WS_GROUP)

$Six = GUICtrlCreateButton("6", 192, 32, 33, 33, $WS_GROUP)

$Seven = GUICtrlCreateButton("7", 224, 32, 33, 33, $WS_GROUP)

$Eight = GUICtrlCreateButton("8", 256, 32, 33, 33, $WS_GROUP)

$Nine = GUICtrlCreateButton("9", 288, 32, 33, 33, $WS_GROUP)

$Zero = GUICtrlCreateButton("0", 320, 32, 33, 33, $WS_GROUP)

$Minus = GUICtrlCreateButton(")", 352, 32, 33, 33, $WS_GROUP)

$Equal = GUICtrlCreateButton("-", 384, 32, 33, 33, $WS_GROUP)

$Back = GUICtrlCreateButton("<-------", 416, 32, 65, 33, $WS_GROUP)

$Insert = GUICtrlCreateButton("Insert", 488, 32, 33, 33, $WS_GROUP)

$Home = GUICtrlCreateButton("Home", 520, 32, 33, 33, $WS_GROUP)

$PageUp = GUICtrlCreateButton("PgUp", 552, 32, 33, 33, $WS_GROUP)

$NumberLock = GUICtrlCreateButton("NmLo", 592, 32, 33, 33, $WS_GROUP)

$NumberPadSlash = GUICtrlCreateButton("/", 624, 32, 33, 33, $WS_GROUP)

$NumberPadX = GUICtrlCreateButton("*", 656, 32, 33, 33, $WS_GROUP)

$NumberPadMinus = GUICtrlCreateButton("-", 688, 32, 33, 33, $WS_GROUP)

$Tab = GUICtrlCreateButton("Tab", 0, 64, 41, 33, $WS_GROUP)

$q = GUICtrlCreateButton("A", 40, 64, 33, 33, $WS_GROUP)

$w = GUICtrlCreateButton("Z", 72, 64, 33, 33, $WS_GROUP)

$e = GUICtrlCreateButton("E", 104, 64, 33, 33, $WS_GROUP)

$r = GUICtrlCreateButton("R", 136, 64, 33, 33, $WS_GROUP)

$t = GUICtrlCreateButton("T", 168, 64, 33, 33, $WS_GROUP)

$y = GUICtrlCreateButton("Y", 200, 64, 33, 33, $WS_GROUP)

$u = GUICtrlCreateButton("U", 232, 64, 33, 33, $WS_GROUP)

$i = GUICtrlCreateButton("I", 264, 64, 33, 33, $WS_GROUP)

$o = GUICtrlCreateButton("O", 296, 64, 33, 33, $WS_GROUP)

$p = GUICtrlCreateButton("P", 328, 64, 33, 33, $WS_GROUP)

$LeftBrackets = GUICtrlCreateButton("[", 360, 64, 33, 33, $WS_GROUP)

$RightBrackets = GUICtrlCreateButton("]", 392, 64, 33, 33, $WS_GROUP)

$Enter = GUICtrlCreateButton("Enter", 424, 64, 57, 65, $WS_GROUP)

$Delete = GUICtrlCreateButton("Del", 488, 64, 33, 33, $WS_GROUP)

$End = GUICtrlCreateButton("End", 520, 64, 33, 33, $WS_GROUP)

$PageDown = GUICtrlCreateButton("PgDn", 552, 64, 33, 33, $WS_GROUP)

$NumberPad7 = GUICtrlCreateButton("7", 592, 64, 33, 33, $WS_GROUP)

$NumberPad8 = GUICtrlCreateButton("8", 624, 64, 33, 33, $WS_GROUP)

$NumberPad9 = GUICtrlCreateButton("9", 656, 64, 33, 33, $WS_GROUP)

$NumberPadPlus = GUICtrlCreateButton("+", 688, 64, 33, 65, $WS_GROUP)

$CapsLock = GUICtrlCreateButton("CapsLck", 0, 96, 49, 33, $WS_GROUP)

$a = GUICtrlCreateButton("Q", 48, 96, 33, 33, $WS_GROUP)

$s = GUICtrlCreateButton("S", 80, 96, 33, 33, $WS_GROUP)

$d = GUICtrlCreateButton("D", 112, 96, 33, 33, $WS_GROUP)

$f = GUICtrlCreateButton("F", 144, 96, 33, 33, $WS_GROUP)

$g = GUICtrlCreateButton("G", 176, 96, 33, 33, $WS_GROUP)

$h = GUICtrlCreateButton("H", 208, 96, 33, 33, $WS_GROUP)

$j = GUICtrlCreateButton("J", 240, 96, 33, 33, $WS_GROUP)

$k = GUICtrlCreateButton("K", 272, 96, 33, 33, $WS_GROUP)

$l = GUICtrlCreateButton("L", 304, 96, 33, 33, $WS_GROUP)

$Colon = GUICtrlCreateButton("M", 336, 96, 33, 33, $WS_GROUP)

$Apostrophe = GUICtrlCreateButton("%", 368, 96, 33, 33, $WS_GROUP)

$RightSlash = GUICtrlCreateButton("£", 400, 96, 33, 33, $WS_GROUP)

$NumberPad4 = GUICtrlCreateButton("4", 592, 96, 33, 33, $WS_GROUP)

$NumberPad5 = GUICtrlCreateButton("5", 624, 96, 33, 33, $WS_GROUP)

$NumberPad6 = GUICtrlCreateButton("6", 656, 96, 33, 33, $WS_GROUP)

$LeftShift = GUICtrlCreateButton("Shift", 0, 128, 33, 33, $WS_GROUP)

$LeftSlash = GUICtrlCreateButton("\", 32, 128, 33, 33, $WS_GROUP)

$z = GUICtrlCreateButton("W", 64, 128, 33, 33, $WS_GROUP)

$x = GUICtrlCreateButton("X", 96, 128, 33, 33, $WS_GROUP)

$c = GUICtrlCreateButton("C", 128, 128, 33, 33, $WS_GROUP)

$v = GUICtrlCreateButton("V", 160, 128, 33, 33, $WS_GROUP)

$b = GUICtrlCreateButton("B", 192, 128, 33, 33, $WS_GROUP)

$n = GUICtrlCreateButton("N", 224, 128, 33, 33, $WS_GROUP)

$m = GUICtrlCreateButton("?", 256, 128, 33, 33, $WS_GROUP)

$Comma = GUICtrlCreateButton(".", 288, 128, 33, 33, $WS_GROUP)

$Dot = GUICtrlCreateButton("/", 320, 128, 33, 33, $WS_GROUP)

$QuestionMark = GUICtrlCreateButton("+", 352, 128, 33, 33, $WS_GROUP)

$RightShift = GUICtrlCreateButton("Shift", 384, 128, 97, 33, $WS_GROUP)

$NumberPad1 = GUICtrlCreateButton("1", 592, 128, 33, 33, $WS_GROUP)

$NumberPad2 = GUICtrlCreateButton("2", 624, 128, 33, 33, $WS_GROUP)

$NumberPad3 = GUICtrlCreateButton("3", 656, 128, 33, 33, $WS_GROUP)

$NumberPadEnter = GUICtrlCreateButton("Enter", 688, 128, 33, 65, $WS_GROUP)

$LeftCtrl = GUICtrlCreateButton("Ctrl", 0, 160, 41, 33, $WS_GROUP)

$LeftWindows = GUICtrlCreateButton("Win", 40, 160, 41, 33, $WS_GROUP)

$LeftAlt = GUICtrlCreateButton("Alt", 80, 160, 41, 33, $WS_GROUP)

$Space = GUICtrlCreateButton("Space", 120, 160, 201, 33, $WS_GROUP)

$RightAlt = GUICtrlCreateButton("Alt", 320, 160, 41, 33, $WS_GROUP)

$RightWindows = GUICtrlCreateButton("Win", 360, 160, 41, 33, $WS_GROUP)

$RightCtrl = GUICtrlCreateButton("Ctrl", 400, 160, 81, 33, $WS_GROUP)

$NumberPad0 = GUICtrlCreateButton("0", 592, 160, 65, 33, $WS_GROUP)

$NumberPadDot = GUICtrlCreateButton(".", 656, 160, 33, 33, $WS_GROUP)

$LeftArrow = GUICtrlCreateButton("<", 488, 160, 33, 33, $WS_GROUP)

$DownArrow = GUICtrlCreateButton("|", 520, 160, 33, 33, $WS_GROUP)

$RightArrow = GUICtrlCreateButton(">", 552, 160, 33, 33, $WS_GROUP)

$UpArrow = GUICtrlCreateButton("^", 520, 128, 33, 33, $WS_GROUP)

;Pictures:

$NumberLockOnPic = GUICtrlCreatePic("on.bmp", 600, 3, 18, 26, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))

$NumberLockOffPic = GUICtrlCreatePic("off.bmp", 600, 3, 18, 26, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))

$CapsLockOnPic = GUICtrlCreatePic("on.bmp", 624, 3, 18, 26, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))

$CapsLockOffPic = GUICtrlCreatePic("off.bmp", 624, 3, 18, 26, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))

$ScrollLockOnPic = GUICtrlCreatePic("on.bmp", 648, 3, 18, 26, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))

$ScrollLockOffPic = GUICtrlCreatePic("off.bmp", 648, 3, 18, 26, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))

$AboutButton = GUICtrlCreateButton("About", 676, 4, 43, 25, $WS_GROUP)

;Setting Pictures:

_GetNumLock()

_GetCapsLock()

_GetScrollLock()

If _GetNumLock() = 1 Then

$NumberLockOn = True

Else

GUICtrlSetState($NumberLockOnPic,$GUI_HIDE)

$NumberLockOn = False

EndIf

If _GetCapsLock() = 1 Then

$CapsLockOn = True

Else

GUICtrlSetState($CapsLockOnPic,$GUI_HIDE)

$CapsLockOn = False

EndIf

If _GetScrollLock() = 1 Then

$ScrollLockOn = True

Else

GUICtrlSetState($ScrollLockOnPic,$GUI_HIDE)

$ScrollLockOn = False

EndIf

;Current focused window will remain focused even after the keyboard GUI is up:

GUISetState(@SW_HIDE)

$WGT = WinGetTitle("","")

GUISetState(@SW_SHOW)

WinActivate($WGT)

;/

While 1

If WinActive($Form1) = False Then

WinSetTitle($Form1,"",$MainGUITitle & WinGetTitle("",""))

EndIf

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

Case $AboutButton

GUISetState(@SW_DISABLE)

GUISetState(@SW_HIDE)

MsgBox(64,"About Virtual Keyboard "&$ProductVersion,"Made by Info @ AutoIt Forums."&@CRLF&"www.autoitscript.com"&@CRLF&"Azerty version made by Neo2606"&@CRLF&"Original version made by Info)

GUISetState(@SW_Enable)

GUISetState(@SW_SHOW)

Case $ScrollLock

_ScrollLockPushed()

Case $NumberLock

_NumberLockPushed()

Case $CapsLock

_CapsLockPushed()

Case $Esc

PressButton("{Escape}",0)

Case $F1

PressButton("{F1}",0)

Case $F2

PressButton("{F2}",0)

Case $F3

PressButton("{F3}",0)

Case $F4

PressButton("{F4}",0)

Case $F5

PressButton("{F5}",0)

Case $F6

PressButton("{F6}",0)

Case $F7

PressButton("{F7}",0)

Case $F8

PressButton("{F8}",0)

Case $F9

PressButton("{F9}",0)

Case $F10

PressButton("{F10}",0)

Case $F11

PressButton("{F11}",0)

Case $F12

PressButton("{F12}",0)

Case $PrintScreen

GUISetState(@SW_HIDE)

PressButton("{PrintScreen}",0)

GUISetState(@SW_SHOW)

Case $PauseBreak

PressButton("{PAUSE}",0)

Case $Igel

PressButton("`",0)

Case $One

PressButton("1",0)

Case $Two

PressButton("2",0)

Case $Three

PressButton("3",0)

Case $Four

PressButton("4",0)

Case $Five

PressButton("5",0)

Case $Six

PressButton("6",0)

Case $Seven

PressButton("7",0)

Case $Eight

PressButton("8",0)

Case $Nine

PressButton("9",0)

Case $Zero

PressButton("0",0)

Case $Minus

PressButton("°",0)

Case $Equal

PressButton("-",0)

Case $Back

PressButton("{Backspace}",0)

Case $Insert

PressButton("{Insert}",0)

Case $Home

PressButton("{Home}",0)

Case $PageUp

PressButton("{PgUp}",0)

Case $NumberPadSlash

PressButton("/",0)

Case $NumberPadX

PressButton("*",0)

Case $NumberPadMinus

PressButton("{-}",0)

Case $Tab

PressButton("{Tab}",0)

Case $q

PressButton("a",0)

Case $w

PressButton("z",0)

Case $e

PressButton("e",0)

Case $r

PressButton("r",0)

Case $t

PressButton("t",0)

Case $y

PressButton("y",0)

Case $u

PressButton("u",0)

Case $i

PressButton("i",0)

Case $o

PressButton("o",0)

Case $p

PressButton("p",0)

Case $LeftBrackets

PressButton("[",0)

Case $RightBrackets

PressButton("]",0)

Case $Enter

PressButton("{Enter}",0)

Case $Delete

PressButton("{Delete}",0)

Case $End

PressButton("{End}",0)

Case $PageDown

PressButton("{PgDn}",0)

Case $NumberPad7

PressButton("{NumPad7}",0)

Case $NumberPad8

PressButton("{NumPad8}",0)

Case $NumberPad9

PressButton("{NumPad9}",0)

Case $NumberPadPlus

PressButton("{+}",0)

Case $a

PressButton("q",0)

Case $s

PressButton("s",0)

Case $d

PressButton("d",0)

Case $f

PressButton("f",0)

Case $g

PressButton("g",0)

Case $h

PressButton("h",0)

Case $j

PressButton("j",0)

Case $k

PressButton("k",0)

Case $l

PressButton("l",0)

Case $Colon

PressButton("m",0)

Case $Apostrophe

PressButton("ù",0)

Case $RightSlash

PressButton("µ",0)

Case $NumberPad4

PressButton("{NumPad4}",0)

Case $NumberPad5

PressButton("{NumPad5}",0)

Case $NumberPad6

PressButton("{NumPad6}",0)

Case $LeftSlash

PressButton("\",0)

Case $z

PressButton("w",0)

Case $x

PressButton("x",0)

Case $c

PressButton("c",0)

Case $v

PressButton("v",0)

Case $b

PressButton("b",0)

Case $n

PressButton("n",0)

Case $m

PressButton(",",0)

Case $Comma

PressButton(";",0)

Case $Dot

PressButton(":",0)

Case $QuestionMark

PressButton("=",0)

Case $NumberPad1

PressButton("{NumPad1}",0)

Case $NumberPad2

PressButton("{NumPad2}",0)

Case $NumberPad3

PressButton("{NumPad3}",0)

Case $NumberPadEnter

PressButton("{NumPadEnter}",0)

Case $LeftWindows

PressButton("{Lwin}",0)

Case $Space

PressButton("{Space}",0)

Case $RightWindows

PressButton("{Rwin}",0)

Case $NumberPad0

PressButton("{NumPad0}",0)

Case $NumberPadDot

PressButton("{NumPadDot}",0)

Case $LeftArrow

PressButton("{Left}",0)

Case $DownArrow

PressButton("{Down}",0)

Case $RightArrow

PressButton("{Right}",0)

Case $UpArrow

PressButton("{Up}",0)

Case $LeftShift

If $fLeftShiftHolden = False And $fRightShiftHolden = False Then

PressButton("{SHIFTDOWN}",1)

$fLeftShiftHolden = True

GUICtrlDelete($LeftShift)

$LeftShift = GUICtrlCreateButton("Shift", 0, 128, 33, 33, $WS_GROUP, $WS_EX_CLIENTEDGE)

ElseIf $fLeftShiftHolden = True And $fRightShiftHolden = False Then

PressButton("{SHIFTUP}",1)

$fLeftShiftHolden = False

GUICtrlDelete($LeftShift)

$LeftShift = GUICtrlCreateButton("Shift", 0, 128, 33, 33, $WS_GROUP)

ElseIf $fLeftShiftHolden = False And $fRightShiftHolden = True Then

PressButton("{SHIFTDOWN}",1)

$fRightShiftHolden = False

$fLeftShiftHolden = True

GUICtrlDelete($LeftShift)

GUICtrlDelete($RightShift)

$LeftShift = GUICtrlCreateButton("Shift", 0, 128, 33, 33, $WS_GROUP, $WS_EX_CLIENTEDGE)

$RightShift = GUICtrlCreateButton("Shift", 384, 128, 97, 33, $WS_GROUP)

EndIf

Case $RightShift

If $fRightShiftHolden = False And $fLeftShiftHolden = False Then

PressButton("{SHIFTDOWN}",1)

$fRightShiftHolden = True

GUICtrlDelete($RightShift)

$RightShift = GUICtrlCreateButton("Shift", 384, 128, 97, 33, $WS_GROUP, $WS_EX_CLIENTEDGE)

ElseIf $fRightShiftHolden = True And $fLeftShiftHolden = False Then

PressButton("{SHIFTUP}",1)

$fRightShiftHolden = False

GUICtrlDelete($RightShift)

$RightShift = GUICtrlCreateButton("Shift", 384, 128, 97, 33, $WS_GROUP)

ElseIf $fRightShiftHolden = False And $fLeftShiftHolden = True Then

PressButton("{SHIFTDOWN}",1)

$fLeftShiftHolden = False

$fRightShiftHolden = True

GUICtrlDelete($RightShift)

GUICtrlDelete($LeftShift)

$RightShift = GUICtrlCreateButton("Shift", 384, 128, 97, 33, $WS_GROUP, $WS_EX_CLIENTEDGE)

$LeftShift = GUICtrlCreateButton("Shift", 0, 128, 33, 33, $WS_GROUP)

EndIf

Case $LeftCtrl

If $fLeftCtrlHolden = False And $fRightCtrlHolden = False Then

PressButton("{CTRLDOWN}",1)

$fLeftCtrlHolden = True

GUICtrlDelete($LeftCtrl)

$LeftCtrl = GUICtrlCreateButton("Ctrl", 0, 160, 41, 33, $WS_GROUP, $WS_EX_CLIENTEDGE)

ElseIf $fLeftCtrlHolden = True And $fRightCtrlHolden = False Then

PressButton("{CTRLUP}",1)

$fLeftCtrlHolden = False

GUICtrlDelete($LeftCtrl)

$LeftCtrl = GUICtrlCreateButton("Ctrl", 0, 160, 41, 33, $WS_GROUP)

ElseIf $fLeftCtrlHolden = False And $fRightCtrlHolden = True Then

PressButton("{CTRLDOWN}",1)

$fRightCtrlHolden = False

$fLeftCtrlHolden = True

GUICtrlDelete($LeftCtrl)

GUICtrlDelete($RightCtrl)

$LeftCtrl = GUICtrlCreateButton("Ctrl", 0, 160, 41, 33, $WS_GROUP, $WS_EX_CLIENTEDGE)

$RightCtrl = GUICtrlCreateButton("Ctrl", 400, 160, 81, 33, $WS_GROUP)

EndIf

Case $RightCtrl

If $fRightCtrlHolden = False And $fLeftCtrlHolden = False Then

PressButton("{CTRLDOWN}",1)

$fRightCtrlHolden = True

GUICtrlDelete($RightCtrl)

$RightCtrl = GUICtrlCreateButton("Ctrl", 400, 160, 81, 33, $WS_GROUP, $WS_EX_CLIENTEDGE)

ElseIf $fRightCtrlHolden = True And $fLeftCtrlHolden = False Then

PressButton("{CTRLUP}",1)

$fRightCtrlHolden = False

GUICtrlDelete($RightCtrl)

$RightCtrl = GUICtrlCreateButton("Ctrl", 400, 160, 81, 33, $WS_GROUP)

ElseIf $fRightCtrlHolden = False And $fLeftCtrlHolden = True Then

PressButton("{CTRLDOWN}",1)

$fLeftCtrlHolden = False

$fRightCtrlHolden = True

GUICtrlDelete($RightCtrl)

GUICtrlDelete($LeftCtrl)

$RightCtrl = GUICtrlCreateButton("Ctrl", 400, 160, 81, 33, $WS_GROUP, $WS_EX_CLIENTEDGE)

$LeftCtrl = GUICtrlCreateButton("Ctrl", 0, 160, 41, 33, $WS_GROUP)

EndIf

Case $LeftAlt

If $fLeftAltHolden = False And $fRightAltHolden = False Then

PressButton("{ALTDOWN}",1)

$fLeftAltHolden = True

GUICtrlDelete($LeftAlt)

$LeftAlt = GUICtrlCreateButton("Alt", 80, 160, 41, 33, $WS_GROUP, $WS_EX_CLIENTEDGE)

ElseIf $fLeftAltHolden = True And $fRightAltHolden = False Then

PressButton("{ALTUP}",1)

$fLeftAltHolden = False

GUICtrlDelete($LeftAlt)

$LeftAlt = GUICtrlCreateButton("Alt", 80, 160, 41, 33, $WS_GROUP)

ElseIf $fLeftAltHolden = False And $fRightAltHolden = True Then

PressButton("{ALTDOWN}",1)

$fRightAltHolden = False

$fLeftAltHolden = True

GUICtrlDelete($LeftAlt)

GUICtrlDelete($RightAlt)

$LeftAlt = GUICtrlCreateButton("Alt", 80, 160, 41, 33, $WS_GROUP, $WS_EX_CLIENTEDGE)

$RightAlt = GUICtrlCreateButton("Alt", 320, 160, 41, 33, $WS_GROUP)

EndIf

Case $RightAlt

If $fRightAltHolden = False And $fLeftAltHolden = False Then

PressButton("{ALTDOWN}",1)

$fRightAltHolden = True

GUICtrlDelete($RightAlt)

$RightAlt = GUICtrlCreateButton("Alt", 320, 160, 41, 33, $WS_GROUP, $WS_EX_CLIENTEDGE)

ElseIf $fRightAltHolden = True And $fLeftAltHolden = False Then

PressButton("{ALTUP}",1)

$fRightAltHolden = False

GUICtrlDelete($RightAlt)

$RightAlt = GUICtrlCreateButton("Alt", 320, 160, 41, 33, $WS_GROUP)

ElseIf $fRightAltHolden = False And $fLeftAltHolden = True Then

PressButton("{ALTDOWN}",1)

$fLeftAltHolden = False

$fRightAltHolden = True

GUICtrlDelete($RightAlt)

GUICtrlDelete($LeftAlt)

$RightAlt = GUICtrlCreateButton("Alt", 320, 160, 41, 33, $WS_GROUP, $WS_EX_CLIENTEDGE)

$LeftAlt = GUICtrlCreateButton("Alt", 80, 160, 41, 33, $WS_GROUP)

EndIf

EndSwitch

WEnd

Func PressButton($_Key,$_HoldNeeded)

$ReplacedString = StringReplace(WinGetTitle($Form1),"Virtual Keyboard v0.1 Azerty - ","")

If WinActivate($ReplacedString) Then Send($_Key)

If $_HoldNeeded = 1 Then

SoundPlay("Hold.wav")

Else

SoundPlay("Type.wav")

SoundSetWaveVolume(30);Set volume for both Hold.wav and Type.wav

EndIf

EndFunc

Func _GetNumLock(); By GaryFrost

Local $ret

$ret = DllCall("user32.dll","long","GetKeyState","long",$VK_NUMLOCK)

Return $ret[0]

EndFunc

Func _GetScrollLock(); By GaryFrost

Local $ret

$ret = DllCall("user32.dll","long","GetKeyState","long",$VK_SCROLL)

Return $ret[0]

EndFunc

Func _GetCapsLock(); By GaryFrost

Local $ret

$ret = DllCall("user32.dll","long","GetKeyState","long",$VK_CAPITAL)

Return $ret[0]

EndFunc

Func Quit()

GUIDelete($Form1)

Exit

EndFunc

Link to comment
Share on other sites

  • 2 years later...

i dont think it working right. Has there been an update ?

When i highlight input box and use this keyboard to type in text into highlighted input box, it only enters one character instead of all that i clicked on. Because when input is selected, whole text becomes highlighted and deletes previous character on Send

Link to comment
Share on other sites

i dont think it working right. Has there been an update ?

When i highlight input box and use this keyboard to type in text into highlighted input box, it only enters one character instead of all that i clicked on. Because when input is selected, whole text becomes highlighted and deletes previous character on Send

I'm not quite sure what dirty is refering to, but I thought I ought to mention that when I tried this, I found another problem. It seems that, on exit, the keyboard closes without releasing held keys. If I remember correctly, I couldn't release the CTRL key.

That's what you get when you use code that's 2+ years old :)

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Link to comment
Share on other sites

I always future proof my own scripts. ;).

Me too :)

I compile them to exe as well as including the source. That way if there's any script breaking changes to AutoIt, the exe will still work!

I've got too many ideas, not enough time.

I figure one of these days I'll get a touchscreen monitor, then a virtual keyboard will be a great addition since I would want to put up the physical keyboard.

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

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...