Hotkeyset gleichzeitig ?

  • Ich meine, ich habe mal irgendwo etwas darüber gelesen, kann es aber nicht wiederfinden.
    Und bevor ich mir die Send & Hotkeyset Doku zum 6. mal durchlesen, frag ich doch einfach mal.

    Und zwar möchte ich sowas machen :

    HotKeySet("123","func")

    Das soll aber nur ausgelöst werden, wenn man die alle gleichzeitig drückt.
    Bin mir auch sicher, das schonmal gesehen zu haben.

    Hoffe ihr könnt mir helfen :)

    Mfg,
    Dankeschön

    Zitat

    Programmieren ist so lange lustig bis ein Fehler auftritt!


    ~ Dankeschön

    Einmal editiert, zuletzt von Dankeschön (25. Oktober 2009 um 21:14)

  • Wie wärs hiermit:

    [autoit]

    #include <Misc.au3>
    Func _Box()
    MsgBox(0,"Yoyo","Das ist ne Box... undso...")
    EndFunc

    [/autoit][autoit][/autoit][autoit]

    While 1 * Sleep(20)
    If _IsPressed(31) AND _IsPressed(32) AND _IsPressed(33) Then
    _Box()
    EndIf

    [/autoit][autoit][/autoit][autoit]

    ; hier kann dann GUIGetMsg oder was auch immer kommen...
    WEnd

    [/autoit]


    Vielleicht gibts ja auch ne elegantere Lösung.


    Edit Zu beachten ist folgendes:
    Wenn du die Funktion _IsPressed() ausgiebig in deinem Script verwenden wirst, solltest du das es so machen

    [autoit]


    #include <Misc.au3>

    [/autoit][autoit][/autoit][autoit]

    $dll = DllOpen("user32.dll")

    [/autoit][autoit][/autoit][autoit]

    Func _Box()
    MsgBox(0,"Yoyo","Das ist ne Box... undso...")
    EndFunc

    [/autoit][autoit][/autoit][autoit]

    While 1 * Sleep(20)
    If _IsPressed(31,$dll) AND _IsPressed(32,$dll) AND _IsPressed(33,$dll) Then
    _Box()
    EndIf

    [/autoit][autoit][/autoit][autoit]

    ; hier kann dann GUIGetMsg oder was auch immer kommen...
    WEnd

    [/autoit][autoit][/autoit][autoit]

    DllClose($dll)

    [/autoit]
  • Das Problem ist, dass ich variable Hotkeys benutzen möchte.
    Das wäre über ispressed viel zu aufwendig, bei hotkeyset dagegen nur auslesen + hotkeyset($String)

    Zitat

    Programmieren ist so lange lustig bis ein Fehler auftritt!


    ~ Dankeschön

    • Offizieller Beitrag

    1-2-3 ist aber kein Hotkey.
    Von den Standardtasten kannst du in einem Hotkey immer nur eine Taste verwenden. Maximale Länge ergibt sich aus:
    Shift+Strg+Alt+'sonstige_Taste'
    Ich denke, damit lassen sich soviele Kombinationen abbilden, dass 1-2-3 o.ä. nun wirklich nicht nötig ist.

  • Das ist mir schon klar.
    Nur darf es kein offensichtlicher hotkey sein,
    soll also so aussehen, als würde man normal schreiben.

    Und das erlauben halt nur normale Buchstaben.
    Außerdem soll die Kombination nicht entdeckt werden...

    Aber das muss doch möglich sein, besonders weil ich das glaube ich mal gesehen habe.

    Zitat

    Programmieren ist so lange lustig bis ein Fehler auftritt!


    ~ Dankeschön

  • Spoiler anzeigen
    [autoit]

    #include <Misc.au3>
    #include <GUIConstants.au3>
    $dll = DllOpen("user32.dll")
    $Key1 = 31 ; 1
    $Key2 = 32 ; 2
    $Key3 = 33 ; 3

    [/autoit] [autoit][/autoit] [autoit]

    GUICreate("Buttons einstellen", 220, 85)
    $123 = GUICtrlCreateButton("1,2,3",20,30,50,25)
    $abc = GUICtrlCreateButton("a,b,c",80,30,50,25)
    $qm = GUICtrlCreateButton("q,m",140,30,50,25)
    GUISetState()

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _Box()
    MsgBox(0,"Yoyo","Das ist ne Box... undso...")
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    While 1 * Sleep(20)
    If _IsPressed($Key1,$dll) Then

    If Not $Key2 = 0 Then
    If _IsPressed($Key2,$dll) Then

    If Not $Key3 = 0 Then
    If _IsPressed($Key3,$dll) Then
    _Box()
    EndIf
    Else
    _Box()
    EndIf
    EndIf
    Else
    _Box()
    EndIf
    EndIf
    $msg = GUIGetMsg()
    Switch $msg
    Case $abc
    $Key1 = 41
    $Key2 = 42
    $Key3 = 43
    TrayTip("Erfolg","A,B,C als Tastenkombination gewählt",1)
    Case $123
    $Key1 = 31
    $Key2 = 32
    $Key3 = 33
    TrayTip("Erfolg","1,2,3 als Tastenkombination gewählt",1)
    Case $qm
    $Key1 = 51
    $Key2 = "4D"
    $Key3 = 0
    TrayTip("Erfolg","q,m als Tastenkombination gewählt",1)
    Case $GUI_EVENT_CLOSE
    Exit
    EndSwitch

    ; hier kann dann GUIGetMsg oder was auch immer kommen...
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    DllClose($dll)

    [/autoit]

    Habs jetzt nich so wirklich ausgiebig getestet...
    Und wirklich "Flexibel" ist das ja auch nicht...

  • [autoit]

    #include <Misc.au3>
    $dll = DllOpen("user32.dll")
    $string = "atu"

    [/autoit][autoit][/autoit][autoit][/autoit][autoit]

    $converted = StringToIsPressed($string)
    MsgBox(0,"",$string & @crlf & $converted)

    [/autoit][autoit][/autoit][autoit]

    While 1
    Sleep(20)
    If IsPressedIsPressedCode($converted) Then MsgBox(0,"","Funzt :)")
    WEnd

    [/autoit][autoit][/autoit][autoit]

    Func StringToIsPressed($string)
    If Not StringIsAlNum($string) Then
    SetError(-1)
    Return -1
    EndIf
    $endstring = "first"
    For $loop = 1 To StringLen($string)
    $tmpkey = StringLower(StringTrimLeft(StringLeft($string,$loop),$loop-1))
    Switch $tmpkey
    Case "a"
    $returncode = 41
    Case "b"
    $returncode = 42
    Case "c"
    $returncode = 43
    Case "d"
    $returncode = 44
    Case "e"
    $returncode = 45
    Case "f"
    $returncode = 46
    Case "g"
    $returncode = 47
    Case "h"
    $returncode = 48
    Case "i"
    $returncode = 49
    Case "j"
    StringUpper($tmpkey)
    $returncode = 4 & $tmpkey
    Case "k"
    StringUpper($tmpkey)
    $returncode = 4 & $tmpkey
    Case "l"
    StringUpper($tmpkey)
    $returncode = 4 & $tmpkey
    Case "m"
    StringUpper($tmpkey)
    $returncode = 4 & $tmpkey
    Case "n"
    StringUpper($tmpkey)
    $returncode = 4 & $tmpkey
    Case "o"
    StringUpper($tmpkey)
    $returncode = 4 & $tmpkey
    Case "p"
    $returncode = 50
    Case "q"
    $returncode = 51
    Case "r"
    $returncode = 52
    Case "s"
    $returncode = 53
    Case "t"
    $returncode = 54
    Case "u"
    $returncode = 55
    Case "v"
    $returncode = 56
    Case "w"
    $returncode = 57
    Case "x"
    $returncode = 58
    Case "y"
    $returncode = 59
    Case "z"
    $returncode = "5A"
    Case 0
    $returncode = 3 & $tmpkey
    Case 1
    $returncode = 3 & $tmpkey
    Case 2
    $returncode = 3 & $tmpkey
    Case 3
    $returncode = 3 & $tmpkey
    Case 4
    $returncode = 3 & $tmpkey
    Case 5
    $returncode = 3 & $tmpkey
    Case 6
    $returncode = 3 & $tmpkey
    Case 7
    $returncode = 3 & $tmpkey
    Case 8
    $returncode = 3 & $tmpkey
    Case 9
    $returncode = 3 & $tmpkey
    EndSwitch
    If $endstring <> "first" Then
    $endstring = $endstring & "|" & $returncode
    Else
    $endstring = $returncode
    EndIf
    Next
    Return $endstring
    EndFunc

    [/autoit][autoit][/autoit][autoit]

    Func IsPressedIsPressedCode($code)
    $split = StringSplit($code,"|")
    For $loop = 1 To $split[0]
    If _IsPressed($split[$loop],$dll) Then
    ContinueLoop
    Else
    Return False
    EndIf
    Next
    Return True
    EndFunc

    [/autoit]

    Hab ich mir grad selbstgebaut, funktioniert supi :)

    Mfg,
    Dankeschön

    Zitat

    Programmieren ist so lange lustig bis ein Fehler auftritt!


    ~ Dankeschön