 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
azstuenthome
Joined: 03 Nov 2008 Posts: 7
|
Posted: Tue Oct 20, 2009 11:12 pm Post subject: How to Simulate Mouse Back and Forward Buttons |
|
|
My mouse does not have back or forward buttons. How can I use AHK to simulate pressing these buttons on the mouse? I found an AHK script called Mouse Gestures which interprets mouse gestures (http://www.autohotkey.com/forum/viewtopic.php?t=1435). I just need to know what keys/commands to assign to the appropriate gesture.
Any help would be much appreciated. |
|
| Back to top |
|
 |
txquestor
Joined: 22 Aug 2009 Posts: 294
|
Posted: Wed Oct 21, 2009 12:37 am Post subject: |
|
|
Which action are you referring to:
scroll ball left and right
or
horizontal scroll forward/back
or
browser forward/back
Check this key/button list link:
http://www.autohotkey.com/docs/commands/Send.htm Or
Send command
Examples:
| Code: |
; scroll ball left and right
; or
; horizontal scroll forward/back
; or
; browser forward/back
#InstallKeybdHook
; Scroll Left/Right
$+<::Send {Left} ; Shift+Left Arrow
$+>::Send {Right} ; Shift+Right Arrow
~LButton:: ; Left Mouse Button, Scroll left
ControlGetFocus, fcontrol, A ; get control with input focus
Loop 2 ; <-- Increase this value to scroll faster.
SendMessage, 0x114, 0, 0, %fcontrol%, A ; 0x114 is WM_HSCROLL and the 0 after it is SB_LINELEFT. OR
SendMessage, 0x115, 0, 0, %fcontrol%, A ; 0x114 is WM_VSCROLL - vertical scrolling
return
~RButton:: ; Right Mouse Button, Scroll right.
ControlGetFocus, fcontrol, A
Loop 2 ; <-- Increase this value to scroll faster.
SendMessage, 0x114, 1, 0, %fcontrol%, A ; 0x114 is WM_HSCROLL and the 1 after it is SB_LINERIGHT. OR
SendMessage, 0x115, 1, 0, %fcontrol%, A ; 0x114 is WM_VSCROLL vertical scrolling
return
; Horizontal Scroll forward/back
$Lalt::Send {WheelLeft} ; Left Alt button
$Ralt::Send {WheelRight} ; Right Alt button
; Browser Forward/Back
$<::Send {Browser_Back} ; Left Arrow, Browser Back Button
$>::Send {Browser_Forward} ; Right Arrow, Browser Forward Button
|
RapidHotKey Example- need to download Rapidhotkey Function
http://www.autohotkey.com/forum/topic38795.html&highlight=rapidhotkey
| Code: |
~RButton::RapidHotkey("Forward""Back", 2, 1) ;two taps RBuitton = Forward, three taps RButton = Back, ~ prevents RButton Activating Contextmenu, instead runs script
Forward:
; ADD Code snippet from above script for whichever one you like. Example
Send {Browser_Forward}
Return
Back:
Send {Browser_Back}
Return
|
Have Fun  _________________
"Man's quest for knowledge is an expanding series whose limit is infinity"
Last edited by txquestor on Wed Oct 21, 2009 3:14 am; edited 2 times in total |
|
| Back to top |
|
 |
[VxE]
Joined: 07 Oct 2006 Posts: 3254 Location: Simi Valley, CA
|
|
| Back to top |
|
 |
azstuenthome
Joined: 03 Nov 2008 Posts: 7
|
Posted: Wed Oct 21, 2009 1:51 pm Post subject: |
|
|
Thanks for the quick response. I didn't know there were so many options to go forward and back. I guess what I was looking for was the browser forward and back. I ended up using the {XButton1} and {XButton2}. I will probably experiment with the others as well.
Thanks again. |
|
| Back to top |
|
 |
Relayer
Joined: 24 Nov 2008 Posts: 68
|
Posted: Wed Oct 21, 2009 8:28 pm Post subject: |
|
|
I use an old Logitech mouse with 2 buttons and a scroll wheel. I got tired of cursor'ing up to the browser back button so this is what I've been using. I love it. It becomes second nature after a bit. It's great too on a notebook when you have no mouse.
To go back you press right then left.
To go forward, press left then right.
| Code: |
~RButton & LButton::
SendInput, {Browser_Back}
SetTimer, RBUp, 10
Return
RBUp:
GetKeyState, state, RButton
if state = U
{
SetTimer, RBUp, Off
SendInput, {Alt}
}
Return
~LButton & RButton::
SendInput, {Browser_Forward}
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
|