 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Wade Guest
|
Posted: Wed Jun 30, 2004 10:42 pm Post subject: Send only works once |
|
|
I'm trying to remap my right ALT key to send a Page Down, and the following code works, but it only works ONCE, and then it quits working!
| Code: |
#InstallKeybdHook
#UseHook
*RAlt::
Send, {PgDn Down}
Loop
{
Sleep, 10
GetKeyState, state, Ralt, P
if state = U ; The key has been released, so break out of the loop.
break
}
Send, {PgDn Up}
return |
I've tried with and without the keyboard hook, and still get the same results. If I use , it works everytime. Anybody have any ideas???? |
|
| Back to top |
|
 |
PenP
Joined: 15 May 2004 Posts: 10 Location: The Netherlands
|
Posted: Wed Jun 30, 2004 11:12 pm Post subject: |
|
|
I think this will work,
| Code: | #InstallKeybdHook
#UseHook
*RAlt::
Send, {PgDn Down}
Loop
{
Sleep, 10
GetKeyState, state, Ralt, P
if state = U ; The key has been released, so break out of the loop.
Send, {PgDn Up}
}
return |
Grtz, PenP |
|
| Back to top |
|
 |
Guest
|
Posted: Thu Jul 01, 2004 12:52 am Post subject: |
|
|
Thanks, but that doesn't even work once..........
In my above example, it shows in the execution log that the key is being pressed, and that the keys are being sent, but nothing happens.... |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Thu Jul 01, 2004 2:50 am Post subject: |
|
|
It appears that the OS (at least XP) has low-level handling for the Alt key. Therefore, even though your press of the ALT hotkey is suppressed (hidden from the system), the OS sees that it is down anyway and thus modifies the behavior of keys accordingly (which we don't want in this case).
As a workaround, this hotkey works on my system, even if you hold down the key to auto-repeat it:
*RAlt::Send {RAlt Up}{PgDn}
I think this fix can be safely built into the program for future versions, so thanks for reporting it.
Btw, you don't need to use the complex method of remapping (as in your example) unless the key needs to be kept held down for gaming purposes or some other atypical use. |
|
| Back to top |
|
 |
Wade Guest
|
Posted: Thu Jul 01, 2004 3:42 am Post subject: |
|
|
| Sweet!!! That works. Thanks for an awesome app! |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|