Jump to content
Sign in to follow this  
avery

Very odd HotKeySet Behavior

Recommended Posts

avery

Ok this is very odd. I have provided an example below that recreates the error or glitch I am experiencing.

If you run the script:

  • hitting just "b" works and keyboard is fine
  • hitting LeftShift+b works and the keyboard is fine
  • hitting RightShift+b works right the first time but things get really weird from here. I can only fix the keyboard when I hit the LeftShift one time after killing the script. If I don't do this none of my special keys work, like when I hit "ESC" key it spells [ESC] on the screen, same for space, enter, backspace etc.

Please just open notepad, run this script, do RSHIFT+b inside notepad and then hit ESC key and see what it does. If you do the same thing with LSHIFT it works fine and also even after the script is killed the keyboard is still broken. For some reason you have to hit LSHIFT 1 time after you kill script to make the keyboard work again.

#include <Misc.au3>
; ------------------------------------------------------------------------------
Global $d = 1
; ------------------------------------------------------------------------------
HotKeySet("b", "agent_b1")
HotKeySet("+b", "agent_b2")
; ------------------------------------------------------------------------------
Func agent_b1()
    ToolTip("Inside agent_b1", 1, 1, "agent_b1")
    HotKeySet("b")
    Send("b")
    If ($d) Then ConsoleWrite("hk: b" & @CRLF)
    HotKeySet("b", "agent_b1")
EndFunc   ;==>agent_b1
; ------------------------------------------------------------------------------
Func agent_b2()
    ToolTip("Inside agent_b2", 1, 1, "agent_b2")
    HotKeySet("+b")
    Send("B")
    If ($d) Then ConsoleWrite("hk: +b" & @CRLF)
    ;Sleep(100)
    HotKeySet("+b", "agent_b2")
EndFunc   ;==>agent_b2
; ------------------------------------------------------------------------------
While 1
    Sleep(1000)
WEnd
; ------------------------------------------------------------------------------

>"C:\abox\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\abox\au3\broken_hk.au3" /autoit3dir "C:\abox\AutoIt3" /UserParams

+>14:16:20 Starting AutoIt3Wrapper v.2.0.0.3 Environment(Language:0409 Keyboard:00000409 OS:WIN_XP/Service Pack 3 CPU:X64 OS:X86)

>Running AU3Check (1.54.19.0) from:C:\abox\AutoIt3

+>14:16:20 AU3Check ended.rc:0

>Running:(3.3.4.0):C:\abox\AutoIt3\autoit3.exe "C:\abox\au3\broken_hk.au3"

OS: Windows XP with latest patches

AV: McAfee (on all pc at my work)

au3 version: 3.3.4.0

Please let me know if you have any further questions. I really need to get this fixed for a work project.

Thank you so much! I am willing to donate again for this help. I've donated twice already because this community has helped me out many, many times before.

Respectfully,

Avery Howell


www.abox.orgAvery HowellVisit My AutoIt Websitehttp://www.abox.org

Share this post


Link to post
Share on other sites
Fulano

It looks like you are mixing HotKeys and send. Your problem might be related to the known bug discussed in the FAQ here.

Hope this helps.


#fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja!

Share this post


Link to post
Share on other sites
avery

It looks like you are mixing HotKeys and send. Your problem might be related to the known bug discussed in the FAQ here.

Hope this helps.

ControlSend("", "", "", "text", 0)

works for the most part. If I hold shift+b it shows the right results most of the time. My results look like this:

BBbBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBbBBBBBBBBBBBBBBBBBBBBBBbBBbBBBBBBBBBbBBBBBbBBBBBBbBBBBBBBBBBBBBBBBBBB

Do you think if I shorten the delay from 1000 to 500ms I'd get less "b"'s because when I hold the hotkey +b (shift B) i should get all capitial b"s (B).

Thanks again for the help, that FAQ is amazing and I bookmarked it.

Edited by avery

www.abox.orgAvery HowellVisit My AutoIt Websitehttp://www.abox.org

Share this post


Link to post
Share on other sites
avery

_SendEx seems to have fixed some of it but it misses some.

If I hit shift+b really fast 15 times I only see 5 of them

:idea::)

Edited by avery

www.abox.orgAvery HowellVisit My AutoIt Websitehttp://www.abox.org

Share this post


Link to post
Share on other sites
Fulano

It looks like you are mixing HotKeys and send.

Nope. The correct hotkey key is disabled before the send(samekey) is used.

Actually I was referring to the modifier keys' tendency of getting 'stuck' on or off when a hotkey calls send(), not a lack of unsetting the hotkey.


#fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja!

Share this post


Link to post
Share on other sites
Fulano

Aha, So thats why my selection was acting all weird.

Annoying isn't it? Took me forever (and a few helpful prods from the guys on the forum) to figure it out.

#fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja!

Share this post


Link to post
Share on other sites
martin

(O, I did not follow your link, so overlooked your reverence.)

Quite so m'lud.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
Fulano

.::Fulano bows deeply, becomes overbalanced and slams into an unfortunately placed suit of armor::. Posted Image

Edited by Fulano

#fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja!

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.