Auto hot key mapping to switch Control and Alt ^<+Tab::ShiftAltTab does not work - autohotkey

I'd like to use the following Auto Hot Key shortcuts to switch CTRL and ALT:
LCtrl & Tab::AltTab
return
^<+Tab::ShiftAltTab
return
But I've got an error The AltTab hotkey "^<+Tab" must specify which key (L or R).
Changed then I get another error: ... must have exactly one modifier/prefix.
<^<+Tab::ShiftAltTab
return
I found my question asked on Reddit too but no answer there:
https://www.reddit.com/r/AutoHotkey/comments/bb5xlv/tab_for_alttab_tab_for_shiftalttab_how

Try this
; LCtrl + Tab
<^Tab::
Send, {Alt Down}{Tab}
KeyWait, LCtrl ; waits for LCtrl to be relesead
Send, {Alt Up}
return
; LCtrl + LShift + Tab
<^<+Tab::
Send, {Alt Down}{Shift Down}{Tab}
KeyWait, LCtrl
KeyWait, LShift
Send, {Alt Up}
return

Related

Autohotkey not working in alttab

ShiftAltTab::AltTab
what i am trying to do is change ShiftAltTab to Alt tab only but my code does not work and it give me an error ("invalid hotkey")
The following should work:
!Tab::
Send, {Shift Down}{Alt Down}{Tab}
KeyWait, Alt
Send, {Shift Up}{Alt Up}
return

Toggle Shift for Single Keypress

I am trying to turn my shift key into a CapsLock of sorts. The goal being that, when Shift is pressed, it shifts the next key to be pressed (eliminating the need to hold down the shift key), similar to the function of StickyKeys but only for the Shift key. I am able to toggle the Shift key using:
LShift:: Send % "{Blind}{LShift " . ((lshift:=!lshift) ? "Down}" : "Up}")
But that requires me to press Shift again, basically turning it into a CapsLock. How can I have this action only last for one keypress?
This should do:
$LShift::
SendInput, {LShift Down}
KeyWait, LShift
SendInput, {LShift Down}
Input, Key, L1 V
SendInput, {LShift Up}
Return
edit:
$*LShift::
SendInput, {LShift Down}
Input, Key, L1 M V
If GetKeyState("LShift", "P")
KeyWait, LShift
SendInput, {LShift Up}
Return

AHK Disable Script A when Script B is Executed

hi again my script is almost complete but there is problem in executing hotkeys
Problem : when i hit Alt + Space it is conflicting with Space .. they are overlaping each other or executing both hotkey which makes custom modifier keys unstable or not working as intented
here is the code:
space::
send {shift down}{MButton down}
KeyWait, space
send {shift up}{Mbutton up}
return
!space::
send {Mbutton down}
KeyWait, space
keywait, alt
send {Mbutton Up}
return
#if, GetKeyState("MButton")
Lbutton::
RButton::
return
#if
i want to add a rule if alt + space keycombo is held down this hotkey will not work
meaning i want to disable Script A if Script B is executed
Script A ::
space::
send {shift down}{MButton down}
KeyWait, space
send {shift up}{Mbutton up}
return
Script B ::
!space::
send {Mbutton down}
KeyWait, space
keywait, alt
send {Mbutton Up}
return
thank you in advance
Wrap the space:: part in #If, !GetKeyState("Alt")
!space::
send {Mbutton down}
KeyWait, space
keywait, alt
send {Mbutton Up}
return
#if, !GetKeyState("Alt")
space::
send {shift down}{MButton down}
KeyWait, space
send {shift up}{Mbutton up}
return
#if, GetKeyState("MButton")
Lbutton::
RButton::
return
#if
space::
Hotkey_Alt_Space = 0 ; disabled
send {shift down}{MButton down}
KeyWait, space
send {shift up}{Mbutton up}
Hotkey_Alt_Space = 1
return
!space::
If (Hotkey_Alt_Space != 0) ; enabled
{
send {Mbutton down}
KeyWait, space
keywait, alt
send {Mbutton Up}
}
return
i was help by someone at AHK forum thank you for time the problem is solve i am able to customize my rotate and pan navigation at sketchup

Autohotkey, Step by Step Execution

This may be a very simple code but I am not able to find how to do it.
I have this
Send, Hi
Send, How Are you
Send, I am Fine
I want to do it like this
Hi How Are you
....
Right now with the below code
KeyWait, Capslock
Send, Hi
KeyWait, Capslock
Send, How Are you
KeyWait, Capslock
Send, I am Fine
I get
HiHow Are YOuI Am Fine as soon as I press Capslock.
I want it to wait to execute the next command. THanks for your help.
KeyWait, Capslock
Send {Capslock} ; Tap it again to reset it and force it to be released
; or Send {Capslock Up} to force it to be released
; or SetCapslockState Off to disable it completley
Send, Hi KeyWait, Capslock{Enter}
Send, How Are you KeyWait, Capslock{Enter}
Send, I am Fine{Enter}
If you want it in a hotkey, you could do something like this.
~$CapsLock::
Send {CapsLock Up}
Send, Hi {Enter}
KeyWait, Capslock, D
Send {CapsLock Up}
Send, How Are you{Enter}
KeyWait, Capslock
Send {CapsLock Up}
Send, I am Fine{Enter}
return
(It's glitching on my computer, but it may be because I'm on a virtual machine.)
SetCapslockState
Sorry if it is too late,but i did it anyways for everyone searching the solution for it,i assume you want to change it every time u press capslock to be different text:
CapsLock::
CapsLock0:
{
SendRaw Hi
Sleep 500
KeyWait, CapsLock, D
{
Goto CapsLock1
}
}
Return
CapsLock1:
{
SendRaw How Are you
Sleep 500
KeyWait, CapsLock, D
{
Goto CapsLock2
}
}
Return
CapsLock2:
{
SendRaw I am Fine
Sleep 500
KeyWait, CapsLock, D
{
Goto CapsLock0
}
}
Return
Explaination for Sleep,it is used because if you would press CapsLock without it then 2 of the command blocks would be executed,it is especially needed.
How about this...
Capslock::
Send, Hi{Enter}
Sleep, 400 ; sleep briefly to allow the CapsLock key to be released
KeyWait, Capslock, D
Send, How Are you?{Enter}
Sleep, 400
KeyWait, Capslock, D
Send, I am fine Thank you.{Enter}
Return
How about this...
Capslock::
Send, Hi{Enter}
KeyWait, Capslock, U
KeyWait, Capslock, D
Send, How Are you?{Enter}
KeyWait, Capslock, U
KeyWait, Capslock, D
Send, I am fine Thank you.{Enter}
Return

Autohotkey: re-map arrow keys

I'm trying to re-map the arrow keys to a combination of Alt-key to get them more centered on the keyboard. The problem is that I cant get the combination with shift to work (for selecting text while moving the cursor).
This is a starting point:
lalt & ö:: Send, {left}
lalt & å:: Send, {up}
lalt & -:: Send, {down}
lalt & ä:: Send, {right}
Any tips would be appreciated.
This only fixes it for Shift.
lalt & ö::
If GetKeyState("Shift", "D") = true
Send, +{Left}
Else
Send, {Left}
Return
lalt & å::
If GetKeyState("Shift", "D") = true
Send, +{Up}
Else
Send, {Up}
Return
lalt & -::
If GetKeyState("Shift", "D") = true
Send, +{Down}
Else
Send, {Down}
Return
lalt & ä::
If GetKeyState("Shift", "D") = true
Send, +{Right}
Else
Send, {Right}
Return
You can declare alt modifier with ! and shift with +
Combine them to give alt + shift
!ö:: Send, {left}
!å:: Send, {up}
!-:: Send, {down}
!ä:: Send, {right}
+!ö:: Send, +{left}
+!å:: Send, +{up}
+!-:: Send, +{down}
+!ä:: Send, +{right}