Mouse button modifiers - Autohotkey - autohotkey

I want to set up my mouse buttons to perform different functions if I press and hold them, or if I press them while holding down shift/alt/ctrl.
As some trivial examples:
Shift-leftMouseButton = "back" in firefox history?
Shift-rightMouseButton = go forward in firefox,
Press-and-hold right mouse button = some other action in firefox (eg, move to opposite screen and maximize).
EDIT:
I forgot to mention I have 5 mouse buttons. (Microsoft Wireless Laser Mouse 6000)

Well, you can map those combinations to other key combinations, as below.
shift + left mouse -> alt + left
+LBUTTON::SendInput,!{LEFT}
shift + right mouse -> alt + right
+RBUTTON::SendInput,!{RIGHT}
Beyond that, you can execute a series of commands, if you wanted to also, say, activate a Firefox window first.
To do the press-and-hold, you'd have to use a timer and it is a bit more complicated. You'd also need to figure out how you want to execute "some other action." Do you have a set of keystrokes that would achieve what you say? For example, I have CTRL + ` mapped to switch screens, so I'd send that and then Windows key + up to do it.

Related

VSCode move selection of multiple lines up and down

I am trying to get used to VSCode because of dendron and I am friend of learning defaults because I work on too many installs to maintain custom settings.
Is there any equivalent in VSCode to sublime text multiline movement?
I have attached a GIF to show what I mean because I can't seem to find the right google keywords or everyone else means something else than me with saying move multiple cursor lines vertically.
In ST I can move them after selecting them with a cursor via SHIFT + CTRL + Up/Down
GIF of st3 multi line movement
EDIT: Found it. Sublime Text 3 can move blocks by cursor, vscode can't. It only moves by selection. Which ironically work with a single line cursor though.
Select all lines which you want to move up/down then Alt + (arrow key up/ arrow key down ) to move your piece of code up or down.

How to do block select in Colab (also called vertical select / multiline edit)

It is feasible in Jupyter/Sublime text editor, and other places.
How to do it within Colab?
I couldn't find anything in the documentation/shortcuts.
With Mouse:
Press Shift+Alt and then use the mouse
With Keyboard:
Press Shift+Alt and then use the arrow keys to move*
* In my system Shift+Alt+Left/Right will change desktop. But I found that in Colab, once I go up/down as needed (creating the multi-line selection) then I can release Alt and continue only with Shift and move horizontally as needed.
Bonus:
Q: How to move up/down the selected text easily?
A:
If you just press Alt+Up/Down, the line you are in will move Up/Down
If you select some text and press Alt+Up/Down, that block will move Up/Down

An AutoHotkey script to move the cursor two words

I'm attempting to write an AutoHotkey script that moves the cursor to the beginning of the second next word, in a similar way that Window's ctrl + arrows and fn + arrows shortcuts works.
I use very often this pair of shortcuts, but I frequently find that the first one moves the cursor too slowly and the second one too fast. So I would like to get a script that moves the caret, as described, two words instead of one (for example, when pressing ctrl + alt + arrows).
I've never scripted for automated actions on the keyboard before, so this is all new territory for me. I assume anyone with some experience could implement the above in a minute or two.
I have realized that it is much easier than writing an AutoHotkey script, it can be done by recording a macro in Microsoft Word.

Hotkey to come back to where you were before F3?

When you press F3 or you hold Ctrl and click on something in Eclipse it takes you to where the thing your cursor is on was declared.
Is there a hotkey to come back to where you were before? Also, is there a way to keep a history of some sort to press it twice to go back twice? This would be useful when going on "wild goose chases" looking for something random in large code bases.
The only similar thing I know is Ctrl + Q to return to the last edit you made. Before going off you can change something arbitrarily and change it back, go hunting, and do Ctrl + Q to get back to the start.
Alt + Left Arrow (back in history)
Alt + Right Arrow (forward in history)

autohotkey: 3 keys pressed together = hotkey?

language: Autohotkey on Win7
"Shift" plus "right mouse button" plus "mouse wheel up"
I want my hotkey to be holding those three keys simultaneously. I have tried the following without any success
+ & rbutton & wheelup::
send 6
+rbutton & wheelup::
send 6
shift & rbutton & wheelup::
send 6
I always get an error when I try to make this hotkey does anyone know how to do it?
I'm still a newbie but I'll try and help =].
It doesn't seem to work when you use a modifier key with two mouse buttons, so this is a way that kind of works:
+WheelUp::
KeyWait, RButton, D ; Waits for RButton to be pressed down.
MsgBox, This works!
Return
The problem is it clicks (or releases) the right mouse button once the hotkey has run. If you instead put it like so:
+RButton::
KeyWait, WheelUp, D
There will be another problem in that it will work fine for the first use of the hotkey, it will from then on work with only Shift + Right Mouse Button, because it's already waited for WheelUp to be pressed down (or rather scrolled up).
I mucked around for a little bit with GetKeyState and the like but still being new I can't find a way around it xD. These may be sufficient for what you need for now, otherwise better to wait for someone more knowledgeable to post.
With the information from your comment (hold Shift+right and spam WheelUp) following solution works fine. Use Shift + WheelUp and check if the right mosue button is down.
+WheelUp::
if (GetKeyState("RButton", "P"))
send 6
else
send +{WheelUp}
return
You could remove the else part and add a ~ modifier, but then Shift + WheelUp will be catched and blocked by AHK even if you dont press the right mouse button.