Jump to content

Multiple keystroke handling


mike1950r
 Share

Recommended Posts

Yes, just found the problem.  When using Send command, there is no identified device (which make sense).  So I need to think how to react in such a case, give me sometimes to figure it out.  Thanks for finding the issue.

I will get back to you shortly...

Link to comment
Share on other sites

I think the easiest way would be to redirect the hotkey to the first keyboard, which should not be too restrictive.  At least it is a straightforward patch to allow Send command to work...

Link to comment
Share on other sites

Posted (edited)

Hi again,

I've tested the new build,
but unfortunately is does not react on any keystroke.

The older version atleast reacted on "REAL" keyboard keystroke and not on send-messages.

But the new build reacts on nothing.

It seems that after this function nothing is proceeded anymore, waiting for ever.
(perhaps the While/WEnd loop ?)

Thanks for assistance

Cheers mike

Edited by mike1950r
Link to comment
Share on other sites

All works for me so you will need to provide something more substantial for me to further investigate...

here my result from your keys :

Quote

test ^!{ESC}
test !{ESC}
test {DEL}
test {F1}
test {END}
test !a

ps. make sure you dont have any residue of your attempts running around (reboot PC or use _Singleton)

Edited by Nine
Link to comment
Share on other sites

Posted (edited)

Hi again,

I fear that it's just too much effort.

I have no problems with "hotkeyset",
but i have problems how @hotkeypressed is handled.

In fact I'm just searching for a feature, that waits until keystroke is released, when it receives a keystroke.
So it will not always report keystrokes while key is pressed down long time.

This should work for single keystrokes as well as for keystroke-combinations.

Cheers mike

Edited by mike1950r
Link to comment
Share on other sites

Unless you can post a full runable script that shows the problem, I am afraid I won't be able to help you anymore.  As all my tests run successfully (even compiled as CUI).

54 minutes ago, mike1950r said:

I fear that it's just too much effort.

Sorry to hear you giving up easily like that.  Good luck anyway.

Link to comment
Share on other sites

  • 2 weeks later...
On 1/6/2024 at 2:11 PM, Nine said:

Unless you can post a full runable script that shows the problem, I am afraid I won't be able to help you anymore.  As all my tests run successfully (even compiled as CUI).

Sorry to hear you giving up easily like that.  Good luck anyway.

Hi Nine,

no I do not give up.

I just cannot find a solution for my problem.

Here is a script:
 

#include <MsgBoxConstants.au3>

HotKeySet("{ESC}", "HotKeyPressed")
HotKeySet("+!d", "HotKeyPressed") ; Shift-Alt-d

While 1
        Sleep(100)
WEnd

Func HotKeyPressed()
        Switch @HotKeyPressed ; The last hotkey pressed.
                Case "{ESC}" ; String is the {ESC} hotkey.
                        Exit

                Case "+!d" ; String is the Shift-Alt-d hotkey.
                        MsgBox($MB_SYSTEMMODAL, "", "This is a message.")

        EndSwitch
EndFunc   ;==>HotKeyPressed


If I press (SHIFT+Alternate+d) a little bit longer,
the message box comes up one time after the other (multiple times) until the pipe is empty.

I just want the message box come up ONCE no matter how long I have pressed (SHIFT+Alternate+d)

Thanks for assistance.

Cheers mike

Edited by mike1950r
Link to comment
Share on other sites

#include <MsgBoxConstants.au3>

HotKeySet("{ESC}", "HotKeyPressed")
HotKeySet("+!d", "HotKeyPressed") ; Shift-Alt-d

While 1
        Sleep(100)
WEnd

Func HotKeyPressed()
        Switch @HotKeyPressed ; The last hotkey pressed.
                Case "{ESC}" ; String is the {ESC} hotkey.
                        Exit

            Case "+!d" ; String is the Shift-Alt-d hotkey.
                        HotKeySet("+!d")
                        MsgBox($MB_SYSTEMMODAL, "", "This is a message.")
                        HotKeySet("+!d", "HotKeyPressed")
        EndSwitch
EndFunc   ;==>HotKeyPressed

 

When the words fail... music speaks.

Link to comment
Share on other sites

As Nine said, none really knows what are you doing. Post your full script or stop asking people to guess what is the problem in a script that we never saw.

Edited by Andreik

When the words fail... music speaks.

Link to comment
Share on other sites

Andreik,

I cannot post a script, which is complex like a program, which needs a personal large library of all the function I wrote.

But it makes still sense to ask for known limitations working in hotkeypressed switch.
I had got limitation of functions with complex loops inside of hotkeypressed function.
I had to write them less complex, to get the functions working in the switch.

I can try to exclude cases in hotkeypressed switch for testing,
and find out which case(s) cause the problem.

Atleast this code of you works fine to avoid problems, when pressing the key longer.

Case "+!d" ; String is the Shift-Alt-d hotkey.
                        HotKeySet("+!d")
                        MsgBox($MB_SYSTEMMODAL, "", "This is a message.")
                        HotKeySet("+!d", "HotKeyPressed")

I will find out which cases(s) of mine cause the problem, that this code above has no effect anymore in my switch.

Thanks for your assistance.

Cheers mike

Edited by mike1950r
Link to comment
Share on other sites

18 hours ago, Andreik said:

Ok but you understand that even if we want to help you we are just guessing. Hope you'll find a solution.

Hi again,

OK found a solution.

In fact in my Hotkeypressed function there was a lot of stuff before the hotkeypressed switch.

I have changed this in front of the function.

HotKeySetUndo()

$idMenuItem = @HotKeyPressed

HotKeySet()

Then the whole stuff came, which was in front before,

And then afterwards I handled the $idMenuItem variable.

Switch $idMenuItem
    Case "^{TAB}"
        Function()
    Case "^!{ESC}"
        Function2()
    Case "+!{ESC}"
        Function3()
    Case "!{Esc}"
        etc. ...
EndSwitch

Now this works perfectly.

Thanks for your help.

Cheers mike

Edited by mike1950r
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...