AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Reuse as normal keystroke a key also used as hotkey

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
ictium



Joined: 12 Nov 2009
Posts: 8

PostPosted: Sun Nov 22, 2009 3:23 pm    Post subject: Reuse as normal keystroke a key also used as hotkey Reply with quote

I All,

I create a script that triggers when I hold down spacebar and press "f" key.

I noticed that once the script finishes running I cannot use the spacebar in normal text to insert a space.

I tried to use :
Code:
#InstallKeybdHook
GetKeyState, state, space
    if state = D
        Send {Space down}
    else
        Send {Space up}


at the end of the script but it does not help.

I also used the workaround of prefixing "space & f::" with a tilde. It works good but does not prevent me from actually inserting a space when I type the hotkey.


I think the best solution would be to add a final line in the script telling AHK to consider spacebar as a normal key.

Thanks for helping!
Back to top
View user's profile Send private message
i3egohan



Joined: 18 Jul 2006
Posts: 401

PostPosted: Sun Nov 22, 2009 5:27 pm    Post subject: Reply with quote

Seriously... How can we help if you havent even posted your code. Theres obviously bugs
Back to top
View user's profile Send private message
txquestor



Joined: 22 Aug 2009
Posts: 294

PostPosted: Sun Nov 22, 2009 8:20 pm    Post subject: Reply with quote

Since you didn't post you're actual code.
the way you allow normal operation of a key used in a hotkey is:
Quote:

~ (tilde)
When the hotkey fires, its key's native function will not be blocked (hidden from the system). In both of the below examples, the user's click of the mouse button will be sent to the active window:
Hotkeys


Code:

; Allow normal SPACE key
~space::
; OR
~space & f::


Add whatever you hotkey code is after the ::
_________________

"Man's quest for knowledge is an expanding series whose limit is infinity"
Back to top
View user's profile Send private message
ictium



Joined: 12 Nov 2009
Posts: 8

PostPosted: Wed Nov 25, 2009 6:47 am    Post subject: Reply with quote

Thank you for your post. As I said in a previous post I used this approach

Quote:
I also used the workaround of prefixing "space & f::"


and it worked.

My feeling is that since spacebar is used as a hotkey, whatever line at the end of the code that may make it useable as a normal key will never have effect because spacebar as a hotkey will always have precedence whenever the run finishes running.

Thus the "tilde" approach is the right one.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group