Sign in to follow this  
Followers 0
laphlaw

Need program for simultaneous keyboard presses

6 posts in this topic

I'm in need of an application that will change the keyboard to where it recognizes multiple key presses at the same time. In other words, pressing "asdf" at the same time would produce a user defined word/letter once that key combination is released (the same concept as a shorthand machine, what court reporters use).

I've done my fair share of research on Google, and haven't found anything like it yet. I happened to come across "Autohotkey", and I recognized that it's developed in part by you guys! (I've been using AutoIt for a while now). However, I'm not sure if this is it's intended use.

Can someone please point me in the right direction? Thank you

Share this post


Link to post
Share on other sites



Well, look at HotKeySet()

in the helpfile.. you can set key combos in it AFAIK, not sure about setting them like that but.

well, in MS Word, you can set a particular thing tomean another...

ie: isig

would cause word to insert your entire siganture (name, address, dob) or whatever else it is you have pre-defined.

perhaps building a custom profile for word is an idea..

tell it that:

asdf = Welcome to This Building

would mean detatching the dictionary but i think it might work.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

couldnt you use hotkeyset?

CODE
HotKeySet("asdf", "ShowMessage")

while 1

sleep (60000)

wEnd

Func ShowMessage()

MsgBox(4096,"","This is a message.")

EndFunc

Edited by Seagul

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

This ain't pretty, but it works as described:

#include <Misc.au3>
global $dkeymap = ObjCreate("Scripting.Dictionary")
populateKeymap()

$dll = DllOpen("user32.dll")
While 1
    Sleep ( 250 )
    if keysDown("A|S|D|F") then msgbox(0,"","ASDF PRSSSED!")
WEnd
DllClose($dll)

func keysDown($keystring)
    $aKeys = stringSplit($keystring,"|")
    for $i = 1 to $aKeys[0]
        if not _IsPressed(getCode($aKeys[$i]), $dll) then return False
    Next
    return True
EndFunc
            
func getCode($key)
    return $dkeymap.item(StringLower($key))
EndFunc

func populateKeymap()
    $dKeyMap.add("leftmouse","01")
    $dKeyMap.add("rightmouse","02")
    $dKeyMap.add("middlemouse","04")
    $dKeyMap.add("x1mouse","05")
    $dKeyMap.add("x2mouse","06")
    $dKeyMap.add("backspace","08")
    $dKeyMap.add("tab","09")
    $dKeyMap.add("clear","0C")
    $dKeyMap.add("enter","0D")
    $dKeyMap.add("shift","10")
    $dKeyMap.add("ctrl","11")
    $dKeyMap.add("alt","12")
    $dKeyMap.add("pause","13")
    $dKeyMap.add("capslock","14")
    $dKeyMap.add("esc","1B")
    $dKeyMap.add("spacebar","20")
    $dKeyMap.add("pageup","21")
    $dKeyMap.add("pagedown","22")
    $dKeyMap.add("end","23")
    $dKeyMap.add("home","24")
    $dKeyMap.add("leftarrow","25")
    $dKeyMap.add("uparrow","26")
    $dKeyMap.add("rightarrow","27")
    $dKeyMap.add("downarrow","28")
    $dKeyMap.add("select","29")
    $dKeyMap.add("print","2A")
    $dKeyMap.add("execute","2B")
    $dKeyMap.add("printscreen","2C")
    $dKeyMap.add("ins","2D")
    $dKeyMap.add("del","2E")
    $dKeyMap.add("0","30")
    $dKeyMap.add("1","31")
    $dKeyMap.add("2","32")
    $dKeyMap.add("3","33")
    $dKeyMap.add("4","34")
    $dKeyMap.add("5","35")
    $dKeyMap.add("6","36")
    $dKeyMap.add("7","37")
    $dKeyMap.add("8","38")
    $dKeyMap.add("9","39")
    $dKeyMap.add("a","41")
    $dKeyMap.add("b","42")
    $dKeyMap.add("c","43")
    $dKeyMap.add("d","44")
    $dKeyMap.add("e","45")
    $dKeyMap.add("f","46")
    $dKeyMap.add("g","47")
    $dKeyMap.add("h","48")
    $dKeyMap.add("i","49")
    $dKeyMap.add("j","4A")
    $dKeyMap.add("k","4B")
    $dKeyMap.add("l","4C")
    $dKeyMap.add("m","4D")
    $dKeyMap.add("n","4E")
    $dKeyMap.add("o","4F")
    $dKeyMap.add("p","50")
    $dKeyMap.add("q","51")
    $dKeyMap.add("r","52")
    $dKeyMap.add("s","53")
    $dKeyMap.add("t","54")
    $dKeyMap.add("u","55")
    $dKeyMap.add("v","56")
    $dKeyMap.add("w","57")
    $dKeyMap.add("x","58")
    $dKeyMap.add("y","59")
    $dKeyMap.add("z","5A")
    $dKeyMap.add("leftwindows","5B")
    $dKeyMap.add("rightwindows","5C")
    $dKeyMap.add("numericpad0","60")
    $dKeyMap.add("numericpad1","61")
    $dKeyMap.add("numericpad2","62")
    $dKeyMap.add("numericpad3","63")
    $dKeyMap.add("numericpad4","64")
    $dKeyMap.add("numericpad5","65")
    $dKeyMap.add("numericpad6","66")
    $dKeyMap.add("numericpad7","67")
    $dKeyMap.add("numericpad8","68")
    $dKeyMap.add("numericpad9","69")
    $dKeyMap.add("multiply","6A")
    $dKeyMap.add("add","6B")
    $dKeyMap.add("separator","6C")
    $dKeyMap.add("subtract","6D")
    $dKeyMap.add("decimal","6E")
    $dKeyMap.add("divide","6F")
    $dKeyMap.add("f1","70")
    $dKeyMap.add("f2","71")
    $dKeyMap.add("f3","72")
    $dKeyMap.add("f4","73")
    $dKeyMap.add("f5","74")
    $dKeyMap.add("f6","75")
    $dKeyMap.add("f7","76")
    $dKeyMap.add("f8","77")
    $dKeyMap.add("f9","78")
    $dKeyMap.add("f10","79")
    $dKeyMap.add("f11","7A")
    $dKeyMap.add("f12","7B")
    $dKeyMap.add("f13","7C")
    $dKeyMap.add("f14","7D")
    $dKeyMap.add("f15","7E")
    $dKeyMap.add("f16","7F")
    $dKeyMap.add("f17","80H")
    $dKeyMap.add("f18","81H")
    $dKeyMap.add("f19","82H")
    $dKeyMap.add("f20","83H")
    $dKeyMap.add("f21","84H")
    $dKeyMap.add("f22","85H")
    $dKeyMap.add("f23","86H")
    $dKeyMap.add("f24","87H")
    $dKeyMap.add("numlock","90")
    $dKeyMap.add("scrolllock","91")
    $dKeyMap.add("leftshift","A0")
    $dKeyMap.add("rightshift","A1")
    $dKeyMap.add("leftcontrol","A2")
    $dKeyMap.add("rightcontrol","A3")
    $dKeyMap.add("leftmenu","A4")
    $dKeyMap.add("rightmenu","A5")
EndFunc
Edited by lod3n

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

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

This ain't pretty, but it works as described:

... Or, you can use hotkeyset

HotKeySet("asdf", "Func1")
While 1
Sleep(1000)
WEnd

Func Func1()
MsgBox(0,"Keys Pressed", "You Pressed Hotkeys!")
EndFunc
Edited by Paulie

Share this post


Link to post
Share on other sites

What? I wrote this in scite and tried it and it worked Larry.

Share this post


Link to post
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
Sign in to follow this  
Followers 0