 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
savioendrigo
Joined: 01 Jan 2009 Posts: 1 Location: Brazil
|
Posted: Thu Jan 01, 2009 4:17 am Post subject: Some hotkeys just don't work? |
|
|
made the following code for a friend. It works like a turbo for some hotkeys. Although there are some hotkeys that just won't work depending on the order i put them on the .ahk file:
| Code: |
#MaxHotkeysPerInterval 1000
~Enter::Suspend
*2::
loop
{
GetKeyState, state, 2, P
if (state = "U"){
break
} else {
send 2
sleep, 30
}
}
*3::
loop
{
GetKeyState, state, 3, P
if (state = "U"){
break
} else {
send 3
sleep, 30
}
}
4::
Loop
{
GetKeyState, state, 4
if state = U
break
Send yui
sleep, 30
}
return
*5::
loop
{
GetKeyState, state, 5, P
if (state = "U"){
break
} else {
send 5
sleep, 30
}
}
return
*6::
loop
{
GetKeyState, state, 6, P
if (state = "U"){
break
} else {
send 6
sleep, 30
}
}
return
*+4::
loop
{
GetKeyState, state, 4, P
if (state = "U"){
break
} else {
send +4
sleep, 30
}
}
return
*+2::
loop
{
GetKeyState, state, 2, P
if (state = "U"){
break
} else {
send +2
sleep, 30
}
}
return
*+3::
loop
{
GetKeyState, state, 3, P
if (state = "U"){
break
} else {
send +3
sleep, 30
}
}
return
*+5::
loop
{
GetKeyState, state, 5, P
if (state = "U"){
break
} else {
send +5
sleep, 30
}
}
return
*+6::
loop
{
GetKeyState, state, 6, P
if (state = "U"){
break
} else {
send +6
sleep, 30
}
}
return
*q::
loop
{
GetKeyState, state, q, P
if (state = "U"){
break
} else {
send q
sleep, 30
}
}
return
*e::
loop
{
GetKeyState, state, e, P
if (state = "U"){
break
} else {
send e
sleep, 30
}
}
return
*r::
loop
{
GetKeyState, state, r, P
if (state = "U"){
break
} else {
send r
sleep, 30
}
}
return
*t::
loop
{
GetKeyState, state, t, P
if (state = "U"){
break
} else {
send t
sleep, 30
}
}
return
*f::
loop
{
GetKeyState, state, f, P
if (state = "U"){
break
} else {
send f
sleep, 30
}
}
return
*x::
loop
{
GetKeyState, state, x, P
if (state = "U"){
break
} else {
send x
sleep, 30
}
}
return
*c::
loop
{
GetKeyState, state, c, P
if (state = "U"){
break
} else {
send c
sleep, 30
}
}
return
*+q::
loop
{
GetKeyState, state, q, P
if (state = "U"){
break
} else {
send +q
sleep, 30
}
}
return
*+e::
loop
{
GetKeyState, state, e, P
if (state = "U"){
break
} else {
send +e
sleep, 30
}
}
return
*+r::
loop
{
GetKeyState, state, r, P
if (state = "U"){
break
} else {
send +r
sleep, 30
}
}
return
*+t::
loop
{
GetKeyState, state, t, P
if (state = "U"){
break
} else {
send +t
sleep, 30
}
}
return
*+f::
loop
{
GetKeyState, state, f, P
if (state = "U"){
break
} else {
send fffuuucccck
sleep, 30
}
}
return
*+x::
loop
{
GetKeyState, state, x, P
if (state = "U"){
break
} else {
send +x
sleep, 30
}
}
return
*+c::
loop
{
GetKeyState, state, c, P
if (state = "U"){
break
} else {
send +c
sleep, 30
}
}
return
!WheelUp:: Send {vk4Bsc025}
!WheelDown:: Send {vk4Csc026}
|
so if he presses shift+q for a while he will have : QQQQQQQQ
but if he presses shift+r for a while he will have : rrrrrrrr (instead of RRRRR)
first post here, so sorry if I did anything wrong. |
|
| Back to top |
|
 |
[VxE]
Joined: 07 Oct 2006 Posts: 2342
|
Posted: Thu Jan 01, 2009 4:32 am Post subject: |
|
|
You should probably use #UseHook at the top of your script. Additionally, you should look into the different SendModes. _________________ My Home Thread
Common Answers: [1]. It's in the FAQ [2]. Ternary ( a ? b : c ) guide [3]. Post code inside [code][/code] tags ! |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 4367 Location: Qld, Australia
|
Posted: Thu Jan 01, 2009 6:13 am Post subject: |
|
|
#UseHook may help, but only for the hotkeys which do not have "*". IIRC, the keyboard hook is required for wildcard hotkeys.
| Quote: | | so if he presses shift+q for a while he will have : QQQQQQQQ | "Send q" should always result in "q", never "Q"... {Blind} prevents the send from automatically releasing modifier keys, so *q -> {Blind}q is equivalent to q -> q, +q -> Q, ^q -> ^q, etc.
To support multiple keys simultaneously and also reduce redundancy, you could use timers and A_ThisLabel. For instance:
| Code: | ; Support any combination of modifiers:
*2::SetTimer, Repeat_{Blind}2, 30
*2 Up::SetTimer, Repeat_{Blind}2, Off
*3::SetTimer, Repeat_{Blind}3, 30
*3 Up::SetTimer, Repeat_{Blind}3, Off
; Example of longer key name, without modifier support:
Space::SetTimer, Repeat_{Space}, 30
Space Up::SetTimer, Repeat_{Space}, Off
; Example of sending arbitrary text:
4::SetTimer, Repeat_yui, 30
4 Up::SetTimer, Repeat_yui, Off ; It's that simple!
; Must have a label for each one:
Repeat_{Blind}2:
Repeat_{Blind}3:
Repeat_{Space}:
Repeat_yui:
Send % SubStr(A_ThisLabel,8)
return |
|
|
| 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
|