for example
1. ctrl + a → send f10
2. while ctrl is held down and until ctrl is being relased, next press of "a" sends "capslock", 2nd, 3rd, 4th etc
3. and when ctrl is released, it's all reset to normal. so from next time , ctrl + a again sends f10
so ctrl + single "a" does one thing, and next "a" presses does completely different thing as long as ctrl is kept pressed.
is this possible in autohotkey?
kinda complicated hotkey action, is this possible? Topic is solved
Re: kinda complicated hotkey action, is this possible? Topic is solved
Code: Select all
^a::
Send {F10}
more := ["a", "b", "c"], on := True
SoundBeep, 1500
KeyWait, a
KeyWait, Ctrl
on := False
SoundBeep, 1000
Return
#If on
^a::
more.Push(s := more.RemoveAt(1))
Send %s%
Return
#If
Re: kinda complicated hotkey action, is this possible?
mikeyww wrote: ↑21 Apr 2021, 10:39Code: Select all
^a:: Send {F10} more := ["a", "b", "c"], on := True SoundBeep, 1500 KeyWait, a KeyWait, Ctrl on := False SoundBeep, 1000 Return #If on ^a:: more.Push(s := more.RemoveAt(1)) Send %s% Return #If
one word. PERFECT
so if I should send "capslock", can I safely remove "b", "c" and replace "a" with "{capslock}" ?
I tried it but capslock does not toggle on/off, it stays on for the following press.
Re: kinda complicated hotkey action, is this possible?
Using Send to toggle CapsLock requires disabling SetStoreCapsLockMode.
Explained: SetCapsLockState
Code: Select all
^a::
Send {F10}
more := ["{CapsLock}", "b", "c"], on := True
SoundBeep, 1500
KeyWait, a
KeyWait, Ctrl
on := False
SoundBeep, 1000
Return
#If on
^a::
SetStoreCapsLockMode, Off
more.Push(s := more.RemoveAt(1))
Send %s%
Return
#If
Re: kinda complicated hotkey action, is this possible?
thank you so much for correction.mikeyww wrote: ↑21 Apr 2021, 11:55Using Send to toggle CapsLock requires disabling SetStoreCapsLockMode.
Explained: SetCapsLockStateCode: Select all
capslock & f:: send {vk15} more := ["k"], on := True KeyWait, f KeyWait, capslock on := False Return #If on capslock & f:: more.Push(s := more.RemoveAt(1)) Send %s% Return #If
here's my code for reference, and there's problem..
Code: Select all
setstorecapslockmode, off ;use capslock as modifier
setcapslockstate, off
#inputlevel 1
capslock::vkee ;remaps capslock into vkee
#inputlevel 0 ;instead of capslock & ... use vkee & ...
vkee & 9:: ;turns capslock on and off
setcapslockstate % !getkeystate("capslock", "t")
return
vkee & f::
send {a}
more := ["b"], on := True
KeyWait, f
KeyWait, vkee
on := False
Return
#If on
vkee & f::
more.Push(s := more.RemoveAt(1))
Send %s%
Return
#If
and here's the problem
I tested the script and if I press capslock(hold) + f multiple times, it only sends "a" (aaaaaaa) but if I press and hold "f" , the result is like "abbbbbb" which is what I wanted.
this does not happen if I do not use vkee in the script (e.g. ctrl, capslock, alt all works fine)
but I really need to use "vkee" because it is bound to many of my script hotkey lists.
what's the deal? I am despearate
Re: kinda complicated hotkey action, is this possible?
Your question differs from the original one. Custom combinations use a different approach. Others may have some answers for you.
Re: kinda complicated hotkey action, is this possible?
hello @mikeyww thank you for the help last time, I successfully managed to implement your code in the script!
but can I have two or more of it without them conflicting?
for example:
Code: Select all
capslock & f::
send a
more := ["b"], on := True
KeyWait, f
KeyWait, capslock
on := False
Return
#If on
capslock & f::
more.Push(s := more.RemoveAt(1))
Send %s%
Return
#If
return
capslock & r::
send c
more := ["d"], on := True
KeyWait, r
KeyWait, capslock
on := False
Return
#If on
capslock & r::
more.Push(s := more.RemoveAt(1))
Send %s%
Return
#If
oddly two hotkeys refuse to coexist.
while I am on in the first hotkey and turn to second one, the second hotkey sends what first hotkey should send.
so
capslock(kept pressed) + f + r = send ab (it's supposed to send ac), and vice versa!
maybe redundant use of some part of the script is the reason?
Re: kinda complicated hotkey action, is this possible?
Yes. Since variables are global by default, use different variable names for on, maybe onF for the f routines, and onR for the r routines.
In your script, return after #If never executes, because #If is already preceded by Return.
In your script, return after #If never executes, because #If is already preceded by Return.
Re: kinda complicated hotkey action, is this possible?
I changed those two to ONF and ONR respectively
but it still works not as expcted in some point
capslock + f + f + r + r + f + f = send abcddd instead of abcdbb. The two are still connected and interferes the correct use
Re: kinda complicated hotkey action, is this possible?
Different question, different script.
Code: Select all
Global more := []
#If GetKeyState("CapsLock", "T")
r::
f::rotate(A_ThisHotkey)
~CapsLock Up::
more := []
SoundBeep, 1000
Return
#If
rotate(hotkey) {
Static key := {f: ["a", ["b"]], r: ["c", ["d"]]}
Send % more[hotkey].Count() ? (thisKey := more[hotkey].RemoveAt(1), more[hotkey].Push(thisKey))
: (key[hotkey].1, more[hotkey] := key[hotkey].2)
}
Who is online
Users browsing this forum: FanaticGuru, OrangeCat and 150 guests