Jump to content

Origin Keyboard Layout


James
 Share

Recommended Posts

Hey,

With lots and lots of help from Toady I have managed to create my own Keyboard layout!

#cs
    Name: Origin Keyboard Layout
    Author: JBr00ks aka James Brooks
    Description: Original Keyboard Layout
    A+8 B+8 C+8 etc
        Thanks to: Toady and RazerM!
#ce

#include <Misc.au3>

HotKeySet("{F9}", "MyExit")
#NoTrayIcon

If _Singleton("OriginKeyboardLayout", 1) = 0 Then
    MsgBox(262144, "Error", "Origin Keyboard Layout is already running!")
    Exit
EndIf

$DLL = DllOpen("user32.dll")
$File = @ScriptDir & '\keys.txt'
Global $aKeys[26] = ['41', '42', '43', '44', '45', '46', '47', '48', '49', '4A', '4B', '4C', '4D', '4E', '4F', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '5A']

For $i = 0 To 25
    HotKeySet(Chr(Number("0x" & $aKeys[$i]) + 32), "Block") ;add 32 to convert to lowercase A -> 65 a -> 97
Next
For $i = 0 To 25
    HotKeySet(Chr(Number("0x" & $aKeys[$i])), "Block")
Next

While 1
    Sleep(1)
    keys()
WEnd

Func Block()
EndFunc   ;==>Block

Func keys()
    For $i = 0 To 25
        If _IsPressed($aKeys[$i], $DLL) Then
            $sChar = _GetChar(Number("0x" & $aKeys[$i]) + 32)
            If (_IsPressed("10", $DLL) And Not _GetCapsState()) or (Not _IsPressed("10", $DLL) And _GetCapsState()) Then
                HotKeySet(Chr(Asc($sChar) - 32))
                Send(Chr(Asc($sChar) - 32), 1)
                HotKeySet(Chr(Asc($sChar) - 32), "Block")
            Else
                HotKeySet($sChar)
                Send($sChar, 1)
                HotKeySet($sChar, "Block")
            EndIf
            While _IsPressed($aKeys[$i], $DLL) ;key is held down..
                Sleep(1)
            WEnd
        EndIf
    Next
EndFunc   ;==>keys

Func _GetCapsState()
    $avRet = DllCall($DLL, "int", "GetKeyState", "int", 20)
    Return $avRet[0]
EndFunc   ;==>_GetCapsState

Func _GetChar($iChar)
    $iChar += 8
    If $iChar > 122 Then $iChar = 96 + $iChar - 122
    Return Chr($iChar)
EndFunc   ;==>_GetChar

Func MyExit()
    Exit
EndFunc

Do not press shift or have the caps lock on, shift and pressing a key is yet to be added.

Sample Text:

PMTTW UG VIUM QA RIUMA IVL Q TWDM ICBWQB!

Translated Text:

hello my name is james and i love autoit!

Each character is moved 8 places to the right, e.g. x=g, z=h etc.

Thanks to RazerM for the newer better smaller version!

This script is not a virus. It is a new keyobard layout.

Posted Image

Keyboard Layout

Download Origin Keyboard Layout 2 From:

OriginK2.zip (252.2K) Number of downloads: Posted Image

Now works with Caps lock and shift!

-James

Edit:

Changed topic title.Thanks to RazerMUpdated script x2! Edited by JBr00ks
Link to comment
Share on other sites

Hi,

why are you doing this while typing and not afterwards? Would be much easier.

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

I think that what he means is that it would be easier to essentially translate what you type after you have typed it. Instead of changing it while it is typing. But I think that would defeat the purpose of having this as a 'new keyboard' layout. And it would fall under of of an encryption style of program. I think. :-)

Link to comment
Share on other sites

@JBr00ks

I got shift key working now, but caps lock doesnt work (I could use word automation UDFs but i'd rather use a different method)

#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'
Global $aKeys[26] = ['41', '42', '43', '44', '45', '46', '47', '48', '49', '4A', '4B', '4C', '4D', '4E', '4F', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '5A']

For $i = 0 To 25
    HotKeySet(Chr(Number("0x" & $aKeys[$i]) + 32), "Block") ;add 32 to convert to lowercase A -> 65 a -> 97
Next
For $i = 0 To 25
    HotKeySet(Chr(Number("0x" & $aKeys[$i])), "Block")
Next

While 1
    Sleep(1)
    keys()
WEnd

Func Block()
EndFunc   ;==>Block

Func keys()
    For $i = 0 To 25
        If _IsPressed($aKeys[$i], $DLL) Then
            $sChar = _GetChar(Number("0x" & $aKeys[$i]) + 32)
            If _IsPressed("10", $DLL) Then
                HotKeySet(Chr(Asc($sChar)-32))
                Send(Chr(Asc($sChar) - 32), 1)
                HotKeySet(Chr(Asc($sChar)-32), "Block")
            Else
                HotKeySet($sChar)
                Send($sChar, 1)
                HotKeySet($sChar, "Block")
            EndIf
            While _IsPressed($aKeys[$i], $DLL) ;key is held down..
                Sleep(1)
            WEnd
        EndIf
    Next
EndFunc   ;==>key

Func _GetChar($iChar)
    $iChar += 8
    If $iChar > 122 Then $iChar = 96 + $iChar - 122
    Return Chr($iChar)
EndFunc   ;==>_GetChar
Edited by RazerM
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

Erm, RazerM. There is a problem.

This is what the output is for James, 8O[sa. Only the letters need moving forward. The layout is only for letters.

And also you forgot:

Func _GetChar($iChar)
    $iChar += 8
    If $iChar > 90 Then $iChar = 64 + $iChar - 90
;~  If _IsPressed("10", $DLL) Then ;shift?
    Return Chr($iChar)
EndFunc   ;==>_GetChar
Link to comment
Share on other sites

I didn't include the updated _GetChar Function, it's edited in my post now

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

You didn't add the changes so that if Caps Lock is on and shift is pressed, lowercase letters are produced. Update with the following functions.

Func keys()
    For $i = 0 To 25
        If _IsPressed($aKeys[$i], $DLL) Then
            $sChar = _GetChar(Number("0x" & $aKeys[$i]) + 32)
            If (_IsPressed("10", $DLL) And Not _GetCapsState()) or (Not _IsPressed("10", $DLL) And _GetCapsState()) Then
                HotKeySet(Chr(Asc($sChar) - 32))
                Send(Chr(Asc($sChar) - 32), 1)
                HotKeySet(Chr(Asc($sChar) - 32), "Block")
            Else
                HotKeySet($sChar)
                Send($sChar, 1)
                HotKeySet($sChar, "Block")
            EndIf
            While _IsPressed($aKeys[$i], $DLL) ;key is held down..
                Sleep(1)
            WEnd
        EndIf
    Next
EndFunc   ;==>keys

Func _GetCapsState()
    $avRet = DllCall($DLL, "int", "GetKeyState", "int", 20)
    Return $avRet[0]
EndFunc   ;==>_GetCapsState
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

Origin.dll not found in the msi. What does it do?

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

Hmmm, I eventually got it to install, but when i changed my keyboard settings to origin layout it didn't work.

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

@ProcessorArch says X86

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

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