Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

How to Simulate Mouse Back and Forward Buttons


  • Please log in to reply
4 replies to this topic
azstuenthome
  • Members
  • 7 posts
  • Last active: Oct 21 2009 01:51 PM
  • Joined: 03 Nov 2008
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 (<!-- m -->http://www.autohotke...opic.php?t=1435<!-- m -->). I just need to know what keys/commands to assign to the appropriate gesture.

Any help would be much appreciated.

txquestor
  • Members
  • 294 posts
  • Last active: Dec 21 2009 04:44 PM
  • Joined: 22 Aug 2009
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:
<!-- m -->http://www.autohotke...mmands/Send.htm<!-- m --> Or
Send command

Examples:
; 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. [color=red]OR[/color]
    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. [color=red]OR[/color]
    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
<!-- m -->http://www.autohotke... ... apidhotkey<!-- m -->
~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 :!: :lol:

VxE
  • Moderators
  • 3622 posts
  • Last active: Oct 24 2013 04:25 AM
  • Joined: 07 Oct 2006
Send, {XButton1} ; the 'back' button on a mouse

Send, {XButton2} ; the 'forward' button on a mouse


azstuenthome
  • Members
  • 7 posts
  • Last active: Oct 21 2009 01:51 PM
  • Joined: 03 Nov 2008
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.