How can I change the keys to change desktop in windows 10 with autohotkey? - windows

Windows 10 has finally multi desktops, you can switch desktops with ctrl+win+right (or left) keys. It's a nice feature, but you have two use two hands to switch desktops.
I'm trying to map the keys like this with autohotkey so I can use just one hand and keep the other one in the mouse..
ctrl + mouse wheel up --> ctrl + win + right
ctrl + mouse wheel down --> ctrl + win + left
the message box comes up so the ctrl + wheel up is working, but it doesn't switches desktops.
~LControl & WheelUp::
MsgBox, Go to desktop right.
Send, {ctrl up}{lwin ctrl righ}
return
~LControl & WheelDown::
MsgBox, Go to desktop left.
Send, {ctrl up}{lwin ctrl left}
return
Any idea why is this not working?.

You can easily switch between two virtual desktops in Windows 10 by using Ctrl+Win+→ or Ctrl+Win+← shortcuts.
But to make this even simpler and easy to use I’ve made this Autohotkey script to toggle betweeen two virtual desktops by just using the (`) key which is the least used key in keyboard.
`::
if (Toggle := !Toggle)
Send #^{right}
else
Send #^{left}
return
Note:- This script works for switching between two desktops only. For creating another virtual desktop you can use the shortcut Ctrl+Win+D.

Inside {} only one key should be specified and I think there's no need for passthrough modifier ~:
LCtrl & WheelUp::Send, {LCtrl up}{LWin down}{LCtrl down}{Right}{LWin up}{LCtrl up}
LCtrl & WheelDown::Send, {LCtrl up}{LWin down}{LCtrl down}{Left}{LWin up}{LCtrl up}
Maybe the standard syntax for modifier keys will also work without sending up-event for LCtrl key:
LCtrl & WheelUp::Send, #{Right}
LCtrl & WheelDown::Send, #{Left}

I know this is an old question but there is now a much better solution that has official support from Microsoft and is really easy to use. Microsoft has recently released an open source tool called Powertoys https://github.com/microsoft/PowerToys . It includes a keyboard manager with a tool for remapping keyboard shortcuts. Its really simple.

Related

AutoHotKey: make Win+Tab act as Alt+Tab, but remap all other Win+ combinations as Ctrl+

I am trying to make my MacBook in Windows behave similar to macOS: so I can switch between apps using Win+Tab (i.e., replicate the Alt+Tab action), but have all the Ctrl+... actions (like, Ctrl+C, Ctrl+V, Ctrl+Z, etc) be accessible using the Win key (Win+C, Win+V, Win+Z).
In other words, I am trying to :
Remap Win key to Ctrl in all key combinations, but also
Have the Win+Tab act exactly as Alt+Tab (and I don't care if Ctrl+Tab stops
working as Ctrl+Tab, because I am not using that key combination at
all).
I am able to separately individually achieve 1. using LWin::Ctrl, and 2. using LWin & Tab::AltTab, but I cannot make them work together. Whenever I have something like
LWin::Ctrl
LWin & Tab::AltTab
or
LWin::Ctrl
Ctrl & Tab::AltTab
it just stops working, I am using Windows 10.
Did you try to use the symbols like documented here?
For your snippet that would mean:
LWin::Ctrl
LWin & Tab::Send, !{Tab}
There is a problem with this, as it simulates closed keystokes (regard !{Tab} as {Alt Down}{Tab}{Alt Up}. If you want to press and hold Win and then use Tab (or eventually tab multiple times), this doesn't work. To adress this issue, I found three main workarounds:
)
Let Alt stick to being pressed down:
LWin::Ctrl
LWin & Tab::Send, {Alt Down}{Tab}
LWin & Capslock::Send, {Alt Up} ;Suppose you won't use that hotkey elsewhere
)
Use something this solution by 2501:
h::AltTabMenu ; Opens the menu. Press second time to close.
n::AltTab ; Alt-Tabs through forwards
m::ShiftAltTab ; Alt-Tabs through backwards
The underlying principles/functionalities are documented here.
) Dig into AHK really deep: here (which is referenced in 1)
Annotation: Be aware that
<#::Ctrl
<#Tab::!Tab
does not work as Windows then handles the win key on its own first. You can verify This by testing:
<#::
MsgBox test
return
<#Tab::
MsgBox test
return

Remapping Alt key to Ctrl key in AutoHotKey causes both keys to be pressed

So, just like the title says, whenever I remap my LAlt key to LCtrl (or LCtrl to LAlt) they both get pressed when either key is used, and this causes a variety of issues.
The main reason I need these keys to be swapped is for use with a Mac keyboard on a Windows 7 computer. Honestly, though, it is only the beginning of my problem. I would actually like the LAlt key to be the LCtrl key, the LWin key to be the LAlt key, and the LCtrl key to be the LWin key so it appropriately emulates the Mac keyboard for personal use within Pro Tools 10. When I attempt this 3-way-swap, LCtrl and LWin function properly (as LWin and LAlt respectively), however, the LAlt key continues to press both LCtrl and LAlt anyways.
My code looks like this:
#IfWinActive
LAlt::LCtrl
LWin::LAlt
LCtrl::LWin
Return
I am fairly new to AHK, but this shouldn't be overly complicated, right? It's pretty short and sweet, and I'm not even worried about the Alt+Tab ordeal; I just need to figure out the issue so these three buttons can be swapped correctly. If anyone has any clue as to why this might be happening, I would be profoundly grateful. Thanks for your time and effort.
I think your hotkeys are probably triggering each other.
When you hit LALT, it sends LCTRL, which triggers LALT...
When you have a hotkey whose output matches the input of another hotkey, prefix your hotkeys with $ to stop them triggering each other:
$LAlt::LCtrl
$LWin::LAlt
$LCtrl::LWin
Also, I don't think your #IfWinActive is doing anything, since it has no WinTitle param, plus the return at the end is not how you end an #IfWinActive block, you start it with #IfWinActive <WinTitle> and end it with #IfWinActive

Mapping RightAlt+Ctrl+a to send Ctrl+Delete?

I have the following map:
>!+a::SendInput,+{Delete}
It's supposed to send Ctrl+Delete (delete word after cursor) when I press RightAlt+Ctrl+a but instead it's sending a Ctrl+Alt+Delete signal so it's bringing up the Windows 7 menu of shutdown, start task manager etc.
How can I send the right signal?
Appreciate any help!
The problem you are facing is that Ctrl + Alt + Delete is hard coded and is uninterruptible. There's simply no way around it, if you press that sequence, even with the Command BlockInput enabled, Windows will re-enable input and execute the command...
Try:
>!^a:: ; + symbol is Shift ^ represents Ctrl key
KeyWait, RAlt ; Waits for Right Alt to be released before Ctrl Delete is sent
SendInput,{Ctrl Down}{Delete}{Ctrl Up}
Return
An alternative although it works the exact same way:
>!^a::
While (GetKeyState("RAlt", "P"))
Continue
SendInput,{Ctrl Down}{Delete}{Ctrl Up}
Return
I'll continue to pursue other options.. at the moment I can I think of no better way to do this.

Autohotkey remap Apple Mac keyboard on Windows PC

I'm trying to configure an Apple Keyboard with numeric pad to work on a Windows notebook.
I found lots of example and scripts and I was able to remap Cmd to Ctrl and all the functions keys to volume controls, media controls, print screen, etc.
I still can't find a way to move focus to next window (from a program to another): on Windows, this is done by LAtl+Tab, on a Mac by Cmd+Tab. Cmd is remapped to Ctrl but I can't find the Autohotkey command to launch the "move focus to next window" action.
I tried with:
LWin & Tab::SendInput{Alt & Tab}
or
LWin & Tab::Send {Alt & Tab}
but it says that This line does not contain a recognized action.
According to the documentation, a proper syntax would be:
LWin & Tab::SendInput !{Tab}
but nothing happens.
Here is my script:
#InstallKeybdHook
#SingleInstance force
SetTitleMatchMode 2
SendMode Input
F7::SendInput {Media_Prev}
F8::SendInput {Media_Play_Pause}
F9::SendInput {Media_Next}
F10::SendInput {Volume_Mute}
F11::SendInput {Volume_Down}
F12::SendInput {Volume_Up}
LCtrl::LWin
LWin::LCtrl
RWin::RCtrl
F13::SendInput {PrintScreen}
F14::SendInput {ScrollLock}
F15::SendInput {Pause}
Any idea? Thank you.
This should do the trick:
LWin & Tab::AltTab

Favorite Windows keyboard shortcuts [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I'm a keyboard junkie. I love having a key sequence to do everything. What are your favorite keyboard shortcuts?
I'll start by naming a couple of mine:
1 - Alt-Space to access the windows menu for the current window
2 - F2 to rename a file in Windows Explorer
Win + Pause/Break to bring up computer information and to access environment variables under the Advanced tab.
Win + R to go straight to the run box (though I barely use this anymore since I started with Launchy).
Of course Alt + Tab but also Alt + Shift + Tab for going backwards.
Oh, and personally, I hate Ctrl + F4 for closing tabs - too much of a pinky stretch.
Oh and try Win + Tab on Windows 7 (with Aero on).
Win + 1 .. 9 -- Start quick launch shortcut at that index (Windows Vista).
Ctrl + Scroll Lock, Scroll Lock -- Crash your computer: Windows feature lets you generate a memory dump file by using the keyboard
#gabr -- Win + D is show desktop, Win + M minimizes all windows. Hitting Win + D twice brings everything back as it has only shown the desktop window in front of the other windows.
Alt-F4 to close a program.
WindowsKey + L to lock my workstation
Ctr-Shift-Ins to copy text from a textbox
Alt-Print Screen to capture a shot of just a window
WindowsKey + R to open the "Run" dialog (XP Pro only- does something else on XP Home)
Win-D to minimize all applications
Ctrl-Shift-Esc to open Task Manager
Win-L to lock the computer..
To maximize a window: Alt+Space, X
To restore a window: Alt+Space, R
To minimize a window: Alt+Space, N
To close a window: Alt+Space, C
I try to stick to my keyboard as well. I frequently use...
Win+L to Lock my system
Alt+F4 to close a program
Win+R to launch from the Run Window (Used for frequent programs instead of going through QuickLaunch)
F2 to rename a file
Win+D to go to Desktop
Alt+Tab and Alt+Tab+Shift to cycle through open programs
Visual Studio
Alt, D (debug), P (process), W (webdev process)
Alt, T (Tools), P (process), W (webdev process) for VS 2008
Alt, M, O to collapse to definitions
F5 to launch
F9, F10, and F11 for stepping through debugger
Alt+K, D to format a document
Alt+K, C to comment
Alt+K, U to uncomment
Browser
Alt+W to close tab
F6 to focus on the address bar
How is this not here?
+Pause to System Information. Then the system PATH variable is only 2 clicks away (Advanced system settings,Environment Variables...)
F4 in windows explorer to access the location bar trivially.
Menu key (next to the right-hand windows key) + W + F to create a new folder in explorer.
Win + E to open an Windows Explorer reference
Win + R from the Run box
Ctrl + Esc to open the start menu
And, of course, Alt + F4 to close things.
A few basic keyboard shortcuts for clipboard operations, text selection, and navigation that work in most Windows programs:
Clipboard
Ctrl+X - Clipboard Cut
Ctrl+C - Clipboard Copy
Ctrl+V - Clipboard Paste
Selecting Text
Ctrl+A - Select All (in the current field or document)
Shift+[navigate with ▲/▼, Home/End, or Pg Up/Pg Dn] - Select text between the caret's previous and new positions. Continue to hold Shift and navigate to select more text.
Navigation
Ctrl+left arrow / Ctrl+right arrow - Move the caret to the previous/next word
Ctrl+Home / Ctrl+End - Go to beginning/end of the current field or document
Bonus Tip!
Before submitting a web form where you've entered a lot of text into a text field (for example, an email in a web-based mail client -- or a new question or answer on Stack Overflow!), do a quick Ctrl+A, Ctrl+C on the field. That way, if something goes wrong with the submit (even if the browser crashes), you haven't lost your work -- you have a copy of it sitting on the clipboard.
Ctrl+Shift+Esc to go straight to the task manager without any intermediate dialogs.
In calc, F5, F6, F7, F8 cycle between Hex, Dec, Oct, Bin mode.
I use the free AutoHotKey, then I define my own shortcuts:
dobule tap F4 quickly => Close active Windows (like Alt+F4 but with one finger only)
double tap Right Alt quickly => Find and Run Robot task manager
F12 => open Find and Run Robot Locate32 plugin (I use it like a very lightweight desktop search)
Ctrl+Up / Down in a command window => scroll back / forward command line like the mouse wheel
Ctrl+w in a command windows => close window
etc.
For when you have a window stuck under an appbar and can't get at that window's system menu to move it:
alt-spacebar -> M -> arrow keys -> return
On Windows Vista, if you bring up the Start menu and search for a program, pressing Ctrl+Shift+Enter will run the selected program as Administrator. So to open an Administrator command prompt:
Windows key, type "cmd", Ctrl+Shift+Enter
My personal favourite is WinKey, U, Enter - shuts Windows down! ;-)
win+M to minimise all. Useful for quick trips to the desktop.
+[type name of program] to launch a program in Vista
+E for explorer
+F for find
Alt+Tab to swap between programs
Ctrl+Tab to swawp between tabs
Not really a 'Windows' shortcut, but the Ctrl+Alt+numpad and Ctrl+Alt+[arrows] to move and resize windows and move them to another monitor using WinSplit Revolution are absolutely great. I would never use large or multiple monitors without them.
Ctrl + Shift + ESC : Run Task Manager
Ctrl/Shift + Insert : Copy/Paste
Shift + Delete : Cut (text)
Win + L : Lock System
Win + R : Run
Ctrl + Pause Break : Break Loop (Programming)
Ctrl + Tab : Tab Change
Win+Pause/Break for System Properties
Win+E: open windows explorer
Win+F: find
Win+R: run
Win+M: minimize all windows
Win+Shift+M: restore all windows
Alt+F4: close program
Alt+Tab: switch between tasks
Ctrl+Alt+Del: task manager
Repeat Ctrl + Alt + Del Twice!
Many say that Win-D minimises all applications. Not true. It simply shows the desktop. Use Win-M to minimise all open windows. Use Win-Shift-M to restore them to their previous state.
By the way, did you notice that the Sift key can be combined with most of the usual shortcuts? e.g. Alt+Tab : cycle through applications 1->2->3->4->...1 Add Shift to the shortcut and you will be cycling in the opposite direction 1<-2<-3<-4<- ...1
Control+Tab to switch between Tabs in most Windows applications (sadly not in Eclipse) - you can already guess what Ctr+Shift+Tab will do. Especially handy in Firefox, IE, etc... where you have more than one Tab open and try going to the previous one. Very handy.
And one more tip, this is soooo handy, I love it. Only found out about it a couple of weeks ago:
FireFox users: tired of rightclick->Open Link in New Tab?
Click a link with MIDDLE mouse button and it will open in a new tab (depends on your Tabs settings in Tools->Options but by default would work). The magical thing about this is that it works even for the browser's Back button! Also when you type a search term into the Google box (usually in top right corner) and middle-click the search button, the search results are opened in a new tab. Closing tabs is also much easier with the middle mouse button (of course you can do Ctrl+W but sometimes the mouse is simply in your hand). You don't have to click the tab's red button to close it. Simply middle-click anywhere on the tab and it will be closed.
EDIT
I just tried the middle button in IE 7 and seems to work just like it does in FF, except for the Back-button and Search widget.
Ctrl + Shift + Esc -> Open Task Manager
Ctrl + W -> closes windows in MDIs where Ctrl+F4 doesn't work
Those and the Win + Number is Vista are used constantly.
Also a nice trick is Win + Tab -> cycles through program groups on task bar in Windows Xp and Server 2003. (i.e. same as Vista without the previews).
It's not a keyboard shortcut, but my favourite trick is to bind the large thumb button on the rat to move window, the smaller thumb button to resize. That way, windows can be moved and resized very easily and naturally. You can probably to that in windows too.
As for keyboard tricks, I use right ctrl+keypad to pick (one of nine) virtual screens. Very quick and natural.
In any dialog with tabs, Ctrl-Page Up/Down to cycle between the tabs.
Not really an answer, but a hint for a good source to look from - if no one cited it above wikipedia has all ( for the most important OS's) - not the best
I don't have favorites among keyboard shortcuts -- they are all utility entities to me...
Except for +L, which means another coffee break!
Windows
Windows right click key, next to the right alt can be very useful.
For the noobs,
tab and shift-tab to cycle through inputs
alt-tab and alt-shift-tab to cycle through the windows
ctrl-tab and alt-shift-tab to cycle through the tabs
ctrl-printscreen to snapshot the entire screen
and alt-printscreen to snapshot the current window
for some dialog windows ctrl-c will copy the message
Console
alt-space then e,p to paste in windows console
alt-space then e,k to mark in console
tab and shifttab to cycle autocomplete in console
Visual Studio
ctrl-shift-f Search in files
ctrl-f Search page
F12 Goto definition of the current word
F2 Rename selected text
F4 Open properties tab for selected
Highlight section and tab or shifttab Indent a block of text
ctrl-k,d Format Document
ctrl-k,c Comment out highlighted text
ctrl-k,u,c Un-comment highlighted text
ctrl-m,o Collapse to definitions
ctrl-m,m Toggle open and close the current method/function
ctrl-alt,l Open solution pane
ctrl-alt,o Open output pane
and of course ctrl-space for intellisense
My favourites are the following (which I have not been able to spot in the responses above):
F12 Save as in Office applications
Ctrl + Home Scroll to the top of the page in most applications or go to cell A1 in Excel
Ctrl + Delete Go back to the cursor in a Word document or back to the active cell in Excel
Ctrl + Shift + End Select a whole table in Excel from its top-left corner. If the table starts at A1, use in conjunction with the above for super speedy one-handed table selecting
It's already been said, but I'm repeating F6 to go directly to the browser address bar because it rocks!

Resources