Jump to content

KeyBoard Layout


Recommended Posts

Hey,

I am trying to create my own Keyboard layout.

I have a few problems though:

  • Block original letters and only allow new ones
  • If shift is pressed it will become a capital (I only added caps for testing purposes)
#cs
    Name: Origin Keyboard Layout
    Author: JBr00ks aka James Brooks
    Description: Original Keyboard Layout
        A+8 B+8 C+8 etc
#ce

#include <Misc.au3>

$DLL = DllOpen("user32.dll")
$File = @ScriptDir & '\keys.txt'

While 1
    Sleep(100)
    _Keys()
Wend

Func _Keys()
    If _IsPressed("41", $dll) Then Send("I", 1)
    If _IsPressed("42", $dll) Then Send("J", 1)
    If _IsPressed("43", $dll) Then Send("K", 1)
    If _IsPressed("44", $dll) Then Send("L", 1)
    If _IsPressed("45", $dll) Then Send("M", 1)
    If _IsPressed("46", $dll) Then Send("N", 1)
    If _IsPressed("47", $dll) Then Send("O", 1)
    If _IsPressed("48", $dll) Then Send("P", 1)
    If _IsPressed("49", $dll) Then Send("Q", 1)
    If _IsPressed("4A", $dll) Then Send("R", 1)
    If _IsPressed("4B", $dll) Then Send("S", 1)
    If _IsPressed("4C", $dll) Then Send("T", 1)
    If _IsPressed("4D", $dll) Then Send("U", 1)
    If _IsPressed("45", $dll) Then Send("V", 1)
    If _IsPressed("4F", $dll) Then Send("W", 1)
    If _IsPressed("50", $dll) Then Send("X", 1)
    If _IsPressed("51", $dll) Then Send("Y", 1)
    If _IsPressed("52", $dll) Then Send("Z", 1)
    If _IsPressed("53", $dll) Then Send("A", 1)
    If _IsPressed("54", $dll) Then Send("B", 1)
    If _IsPressed("55", $dll) Then Send("C", 1)
    If _IsPressed("56", $dll) Then Send("D", 1)
    If _IsPressed("57", $dll) Then Send("E", 1)
    If _IsPressed("58", $dll) Then Send("F", 1)
    If _IsPressed("59", $dll) Then Send("G", 1)
    If _IsPressed("5A", $dll) Then Send("H", 1)
EndFunc

Thanks,

James

Link to comment
Share on other sites

Maybe once this thread is answered then you will be in good shape...

http://www.autoitscript.com/forum/index.php?showtopic=48974

Else just do this...

You need to hotkey the original keys to an empty function to block them. Also for the Shift to work you need to do a check to see if its pressed and if it is then wait there until either it is released or another key has been pressed.

To make the keys only send once instead of it spamming just add a wait for the key _IsPressed() and Not IsPressed().

You should also make the Sleep(100) in the main loop to be a lot smaller, like Sleep(1) because IsPressed() is extremely slow, at least on my work pc.

www.itoady.com

A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding

Link to comment
Share on other sites

#cs
    Name: Origin Keyboard Layout
    Author: JBr00ks aka James Brooks
    Description: Original Keyboard Layout
        A+8 B+8 C+8 etc
#ce

#include <Misc.au3>

HotKeySet("a", "Bletters")
HotKeySet("b", "Bletters")
HotKeySet("c", "Bletters")
HotKeySet("d", "Bletters")
HotKeySet("e", "Bletters")
HotKeySet("f", "Bletters")
HotKeySet("g", "Bletters")
HotKeySet("h", "Bletters")
HotKeySet("i", "Bletters")
HotKeySet("j", "Bletters")
HotKeySet("k", "Bletters")
HotKeySet("l", "Bletters")
HotKeySet("m", "Bletters")
HotKeySet("n", "Bletters")
HotKeySet("o", "Bletters")
HotKeySet("p", "Bletters")
HotKeySet("q", "Bletters")
HotKeySet("r", "Bletters")
HotKeySet("s", "Bletters")
HotKeySet("t", "Bletters")
HotKeySet("u", "Bletters")
HotKeySet("v", "Bletters")
HotKeySet("w", "Bletters")
HotKeySet("x", "Bletters")
HotKeySet("y", "Bletters")
HotKeySet("z", "Bletters")

$DLL = DllOpen("user32.dll")
$File = @ScriptDir & '\keys.txt'

While 1
    Sleep(1)
    _Keys()
Wend

Func _Keys()
    If _IsPressed("41", $dll) Then Send("I", 1)
    If _IsPressed("42", $dll) Then Send("J", 1)
    If _IsPressed("43", $dll) Then Send("K", 1)
    If _IsPressed("44", $dll) Then Send("L", 1)
    If _IsPressed("45", $dll) Then Send("M", 1)
    If _IsPressed("46", $dll) Then Send("N", 1)
    If _IsPressed("47", $dll) Then Send("O", 1)
    If _IsPressed("48", $dll) Then Send("P", 1)
    If _IsPressed("49", $dll) Then Send("Q", 1)
    If _IsPressed("4A", $dll) Then Send("R", 1)
    If _IsPressed("4B", $dll) Then Send("S", 1)
    If _IsPressed("4C", $dll) Then Send("T", 1)
    If _IsPressed("4D", $dll) Then Send("U", 1)
    If _IsPressed("45", $dll) Then Send("V", 1)
    If _IsPressed("4F", $dll) Then Send("W", 1)
    If _IsPressed("50", $dll) Then Send("X", 1)
    If _IsPressed("51", $dll) Then Send("Y", 1)
    If _IsPressed("52", $dll) Then Send("Z", 1)
    If _IsPressed("53", $dll) Then Send("A", 1)
    If _IsPressed("54", $dll) Then Send("B", 1)
    If _IsPressed("55", $dll) Then Send("C", 1)
    If _IsPressed("56", $dll) Then Send("D", 1)
    If _IsPressed("57", $dll) Then Send("E", 1)
    If _IsPressed("58", $dll) Then Send("F", 1)
    If _IsPressed("59", $dll) Then Send("G", 1)
    If _IsPressed("5A", $dll) Then Send("H", 1)
EndFunc
    
Func BLetters()
    ;
EndFunc

I have blocked the letters I hope that HotKeys can goto the same function. Now, I am not sure what you mean with the rest of what you said.

How do I wait until something has been done?

Edited by JBr00ks
Link to comment
Share on other sites

Here is one for the "a" key..

If _IsPressed("41", $dll) Then 
        Send("I", 1)
        While _IsPressed("41") ;key is held down..
            Sleep(1)
        WEnd
    EndIf

You will have to do this for all the other keys as well...

www.itoady.com

A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding

Link to comment
Share on other sites

Whoops, some letters are not recognised.

Look:

#cs
    Name: Origin Keyboard Layout
    Author: JBr00ks aka James Brooks
    Description: Original Keyboard Layout
        A+8 B+8 C+8 etc
#ce

#include <Misc.au3>

HotKeySet("a", "A")
HotKeySet("b", "B")
HotKeySet("c", "C")
HotKeySet("d", "D")
HotKeySet("e", "E")
HotKeySet("f", "F")
HotKeySet("g", "G")
HotKeySet("h", "H")
HotKeySet("i", "I")
HotKeySet("j", "J")
HotKeySet("k", "K")
HotKeySet("l", "L")
HotKeySet("m", "M")
HotKeySet("n", "N")
HotKeySet("o", "O")
HotKeySet("p", "P")
HotKeySet("q", "Q")
HotKeySet("r", "R")
HotKeySet("s", "S")
HotKeySet("t", "T")
HotKeySet("u", "U")
HotKeySet("v", "V")
HotKeySet("w", "W")
HotKeySet("x", "X")
HotKeySet("y", "Y")
HotKeySet("z", "Z")

$DLL = DllOpen("user32.dll")
$File = @ScriptDir & '\keys.txt'

While 1
    Sleep(1)
Wend
    
Func A()
    If _IsPressed("41", $dll) Then
        Send("I", 1)
        While _IsPressed("41") ;key is held down..
            Sleep(1)
        WEnd
    EndIf
EndFunc

Func B()
    If _IsPressed("42", $dll) Then
        Send("J", 1)
        While _IsPressed("42") ;key is held down..
            Sleep(1)
        WEnd
    EndIf
EndFunc

Func C()
    If _IsPressed("43", $dll) Then
        Send("K", 1)
        While _IsPressed("43") ;key is held down..
            Sleep(1)
        WEnd
    EndIf
EndFunc

Func D()
    If _IsPressed("44", $dll) Then
        Send("L", 1)
        While _IsPressed("44") ;key is held down..
            Sleep(1)
        WEnd
    EndIf
EndFunc

Func E()
    If _IsPressed("45", $dll) Then
        Send("M", 1)
        While _IsPressed("45") ;key is held down..
            Sleep(1)
        WEnd
    EndIf
EndFunc

Func F()
    If _IsPressed("46", $dll) Then
        Send("N", 1)
        While _IsPressed("46") ;key is held down..
            Sleep(1)
        WEnd
    EndIf
EndFunc

Func G()
    If _IsPressed("47", $dll) Then
        Send("O", 1)
        While _IsPressed("47") ;key is held down..
            Sleep(1)
        WEnd
    EndIf
EndFunc

Func H()
    If _IsPressed("48", $dll) Then
        Send("P", 1)
        While _IsPressed("48") ;key is held down..
            Sleep(1)
        WEnd
    EndIf
EndFunc

Func I()
    If _IsPressed("49", $dll) Then
        Send("Q", 1)
        While _IsPressed("49") ;key is held down..
            Sleep(1)
        WEnd
    EndIf
EndFunc

Func J()
    If _IsPressed("49A", $dll) Then
        Send("R", 1)
        While _IsPressed("49A") ;key is held down..
            Sleep(1)
        WEnd
    EndIf
EndFunc

Func K()
    If _IsPressed("49B", $dll) Then
        Send("S", 1)
        While _IsPressed("49B") ;key is held down..
            Sleep(1)
        WEnd
    EndIf
EndFunc

Func L()
    If _IsPressed("49C", $dll) Then
        Send("T", 1)
        While _IsPressed("49C") ;key is held down..
            Sleep(1)
        WEnd
    EndIf
EndFunc

Func M()
    If _IsPressed("49D", $dll) Then
        Send("U", 1)
        While _IsPressed("49D") ;key is held down..
            Sleep(1)
        WEnd
    EndIf
EndFunc

Func N()
    If _IsPressed("49E", $dll) Then
        Send("V", 1)
        While _IsPressed("49E") ;key is held down..
            Sleep(1)
        WEnd
    EndIf
EndFunc

Func O()
    If _IsPressed("49F", $dll) Then
        Send("W", 1)
        While _IsPressed("49F") ;key is held down..
            Sleep(1)
        WEnd
    EndIf
EndFunc

Func P()
    If _IsPressed("50", $dll) Then
        Send("X", 1)
        While _IsPressed("50") ;key is held down..
            Sleep(1)
        WEnd
    EndIf
EndFunc

Func Q()
    If _IsPressed("51", $dll) Then
        Send("Y", 1)
        While _IsPressed("51") ;key is held down..
            Sleep(1)
        WEnd
    EndIf
EndFunc

Func R()
    If _IsPressed("52", $dll) Then
        Send("Z", 1)
        While _IsPressed("52") ;key is held down..
            Sleep(1)
        WEnd
    EndIf
EndFunc

Func S()
    If _IsPressed("53", $dll) Then
        Send("A", 1)
        While _IsPressed("53") ;key is held down..
            Sleep(1)
        WEnd
    EndIf
EndFunc

Func T()
    If _IsPressed("54", $dll) Then
        Send("B", 1)
        While _IsPressed("54") ;key is held down..
            Sleep(1)
        WEnd
    EndIf
EndFunc

Func U()
    If _IsPressed("55", $dll) Then
        Send("C", 1)
        While _IsPressed("55") ;key is held down..
            Sleep(1)
        WEnd
    EndIf
EndFunc

Func V()
    If _IsPressed("56", $dll) Then
        Send("D", 1)
        While _IsPressed("56") ;key is held down..
            Sleep(1)
        WEnd
    EndIf
EndFunc

Func W()
    If _IsPressed("57", $dll) Then
        Send("E", 1)
        While _IsPressed("57") ;key is held down..
            Sleep(1)
        WEnd
    EndIf
EndFunc

Func X()
    If _IsPressed("58", $dll) Then
        Send("F", 1)
        While _IsPressed("58") ;key is held down..
            Sleep(1)
        WEnd
    EndIf
EndFunc

Func Y()
    If _IsPressed("59", $dll) Then
        Send("G", 1)
        While _IsPressed("59") ;key is held down..
            Sleep(1)
        WEnd
    EndIf
EndFunc

Func Z()
    If _IsPressed("59A", $dll) Then
        Send("H", 1)
        While _IsPressed("59A") ;key is held down..
            Sleep(1)
        WEnd
    EndIf
EndFunc
Link to comment
Share on other sites

lol you had it right the first time... still use the empty function to block them... just put the comparisons in the _Keys() function as before..

Func _Keys()
    If _IsPressed("41", $dll) Then 
        Send("I", 1)
        While _IsPressed("41")
            Sleep(10)
        WEnd
    EndIf
;other keys...
EndFunc

www.itoady.com

A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding

Link to comment
Share on other sites

I am still having problems with some keys.

#cs
    Name: Origin Keyboard Layout
    Author: JBr00ks aka James Brooks
    Description: Original Keyboard Layout
    A+8 B+8 C+8 etc
#ce

#include <Misc.au3>

HotKeySet("a", "Bletters")
HotKeySet("b", "Bletters")
HotKeySet("c", "Bletters")
HotKeySet("d", "Bletters")
HotKeySet("e", "Bletters")
HotKeySet("f", "Bletters")
HotKeySet("g", "Bletters")
HotKeySet("h", "Bletters")
HotKeySet("i", "Bletters")
HotKeySet("j", "Bletters")
HotKeySet("k", "Bletters")
HotKeySet("l", "Bletters")
HotKeySet("m", "Bletters")
HotKeySet("n", "Bletters")
HotKeySet("o", "Bletters")
HotKeySet("p", "Bletters")
HotKeySet("q", "Bletters")
HotKeySet("r", "Bletters")
HotKeySet("s", "Bletters")
HotKeySet("t", "Bletters")
HotKeySet("u", "Bletters")
HotKeySet("v", "Bletters")
HotKeySet("w", "Bletters")
HotKeySet("x", "Bletters")
HotKeySet("y", "Bletters")
HotKeySet("z", "Bletters")

$DLL = DllOpen("user32.dll")
$File = @ScriptDir & '\keys.txt'

While 1
    Sleep(1)
    Keys()
WEnd

Func Bletters()
    ;
EndFunc

Func Keys()
    If _IsPressed("41", $DLL) Then
        Send("I", 1)
        While _IsPressed("41") ;key is held down..
            Sleep(1)
        WEnd
    EndIf

    If _IsPressed("42", $DLL) Then
        Send("J", 1)
        While _IsPressed("42") ;key is held down..
            Sleep(1)
        WEnd
    EndIf
    
    If _IsPressed("43", $DLL) Then
        Send("K", 1)
        While _IsPressed("43") ;key is held down..
            Sleep(1)
        WEnd
    EndIf

    If _IsPressed("44", $DLL) Then
        Send("L", 1)
        While _IsPressed("44") ;key is held down..
            Sleep(1)
        WEnd
    EndIf
    
    If _IsPressed("45", $DLL) Then
        Send("M", 1)
        While _IsPressed("45") ;key is held down..
            Sleep(1)
        WEnd
    EndIf
    
    If _IsPressed("46", $DLL) Then
        Send("N", 1)
        While _IsPressed("46") ;key is held down..
            Sleep(1)
        WEnd
    EndIf

    If _IsPressed("47", $DLL) Then
        Send("O", 1)
        While _IsPressed("47") ;key is held down..
            Sleep(1)
        WEnd
    EndIf

    If _IsPressed("48", $DLL) Then
        Send("P", 1)
        While _IsPressed("48") ;key is held down..
            Sleep(1)
        WEnd
    EndIf

    If _IsPressed("49", $DLL) Then
        Send("Q", 1)
        While _IsPressed("49") ;key is held down..
            Sleep(1)
        WEnd
    EndIf

    If _IsPressed("49A", $DLL) Then
        Send("R", 1)
        While _IsPressed("49A") ;key is held down..
            Sleep(1)
        WEnd
    EndIf

    If _IsPressed("49B", $DLL) Then
        Send("S", 1)
        While _IsPressed("49B") ;key is held down..
            Sleep(1)
        WEnd
    EndIf

    If _IsPressed("49C", $DLL) Then
        Send("T", 1)
        While _IsPressed("49C") ;key is held down..
            Sleep(1)
        WEnd
    EndIf

    If _IsPressed("49D", $DLL) Then
        Send("U", 1)
        While _IsPressed("49D") ;key is held down..
            Sleep(1)
        WEnd
    EndIf

    If _IsPressed("49E", $DLL) Then
        Send("V", 1)
        While _IsPressed("49E") ;key is held down..
            Sleep(1)
        WEnd
    EndIf

    If _IsPressed("49F", $DLL) Then
        Send("W", 1)
        While _IsPressed("49F") ;key is held down..
            Sleep(1)
        WEnd
    EndIf

    If _IsPressed("50", $DLL) Then
        Send("X", 1)
        While _IsPressed("50") ;key is held down..
            Sleep(1)
        WEnd
    EndIf

    If _IsPressed("51", $DLL) Then
        Send("Y", 1)
        While _IsPressed("51") ;key is held down..
            Sleep(1)
        WEnd
    EndIf

    If _IsPressed("52", $DLL) Then
        Send("Z", 1)
        While _IsPressed("52") ;key is held down..
            Sleep(1)
        WEnd
    EndIf

    If _IsPressed("53", $DLL) Then
        Send("A", 1)
        While _IsPressed("53") ;key is held down..
            Sleep(1)
        WEnd
    EndIf

    If _IsPressed("54", $DLL) Then
        Send("B", 1)
        While _IsPressed("54") ;key is held down..
            Sleep(1)
        WEnd
    EndIf

    If _IsPressed("55", $DLL) Then
        Send("C", 1)
        While _IsPressed("55") ;key is held down..
            Sleep(1)
        WEnd
    EndIf

    If _IsPressed("56", $DLL) Then
        Send("D", 1)
        While _IsPressed("56") ;key is held down..
            Sleep(1)
        WEnd
    EndIf

    If _IsPressed("57", $DLL) Then
        Send("E", 1)
        While _IsPressed("57") ;key is held down..
            Sleep(1)
        WEnd
    EndIf

    If _IsPressed("58", $DLL) Then
        Send("F", 1)
        While _IsPressed("58") ;key is held down..
            Sleep(1)
        WEnd
    EndIf

    If _IsPressed("59", $DLL) Then
        Send("G", 1)
        While _IsPressed("59") ;key is held down..
            Sleep(1)
        WEnd
    EndIf

    If _IsPressed("59A", $DLL) Then
        Send("H", 1)
        While _IsPressed("59A") ;key is held down..
            Sleep(1)
        WEnd
    EndIf
EndFunc   ;==>KeysA
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...