AutoHotkey Community

It is currently May 26th, 2012, 10:11 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: October 21st, 2009, 12:12 am 
Offline

Joined: November 3rd, 2008, 5:34 pm
Posts: 7
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 21st, 2009, 1:37 am 
Offline

Joined: August 22nd, 2009, 11:23 pm
Posts: 294
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/topic38 ... apidhotkey
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 :!: :lol:

_________________
Image
"Man's quest for knowledge is an expanding series whose limit is infinity"


Last edited by txquestor on October 21st, 2009, 4:14 am, edited 2 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 21st, 2009, 3:44 am 
Offline
User avatar

Joined: October 7th, 2006, 8:45 am
Posts: 3330
Location: Simi Valley, CA
Code:
Send, {XButton1} ; the 'back' button on a mouse
Send, {XButton2} ; the 'forward' button on a mouse

_________________
Ternary (a ? b : c) guide     TSV Table Manipulation Library
Post code inside [code][/code] tags!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 21st, 2009, 2:51 pm 
Offline

Joined: November 3rd, 2008, 5:34 pm
Posts: 7
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 21st, 2009, 9:28 pm 
Offline

Joined: November 24th, 2008, 7:22 pm
Posts: 73
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


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: hyper_, JSLover, Leef_me, oldbrother, patgenn123 and 62 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group