Sign in to follow this  
Followers 0
dotnetter

HotKeySet passes space key to the system

7 posts in this topic

Hello,

From AutoIt documentation:

When you set a hotkey, AutoIt captures the key-press and does not pass it on to the active application

Not in my case... When focus is set on some button, pressing space is spawning my function, but also click on the button is performed. Is there any way to avoid that click?

Thanks in advance.

Share this post


Link to post
Share on other sites



#4 ·  Posted (edited)

This can't be your code since it has a syntax error.

Edited by Exit
1 person likes this

My UDFs, Abbrevs and Snippets
If you like my post, just click the like button :) 

Share this post


Link to post
Share on other sites

Nothing fancy:

HotKeySet("{Space}", "dontClickThatButton")

Func dontClickThatButton()

MsgBox(0, "Oh no!", "Ups I did it again..."[color=#ff0000])[/color]

EndFunc

The correction in the example you gave (adding a ")") makes your code work as designed. You hit the space bar and a msgbox appears.

Could you show us your entire code?

1 person likes this

Share this post


Link to post
Share on other sites

Hello again,

You both are right! There was copy/paste error in my code and the code doesn't send the space. I created example more alike my real code which is to long to paste here:

HotKeySet("{Space}", "dontClickThatButton")
While 1
Sleep(10)
WEnd
  
Func dontClickThatButton()
ConsoleWrite("Ups I did it again..." & @CRLF)
EndFunc

1. When focus was set on button in another application and code in my previous post generated MsgBox space WAS "consumed" and everything was fine (sorry for not testing that example thoroughly)

2. The code pasted above passes the space (presses the focused button in another application) indeed, but after more testing I found that it concerns only my particular case - java applet window (in windows applications space was NOT passed)

The workaround:

In first line of my function (dontClickThatButton()) I'm changing focus in the java applet window to some not clickable element and everything works fine.

That closes the case, I suppose.

Thank you for your cooperation :)

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