Hey I used your script for a bit and it was awsome but i personally had a few issues with it.
I think you should give this one a shot, I found it somewere and tinkered with it for a bit to my liking.
If you click the XButton1 it acts as a regular MButton click (just a click), this works in firefox for opening/closing tabs, scrolling (you click it again to stop scrolling, etc). In addition to that, you can PRESS&HOLD XButton1 and move the cursor vert or horz to scroll. This works not only in firefox, but everywhere else also, whereas, the MButton mostly works in firefox because it has it's own mechanism for handling mice.
And XButton2 = back button...
This is the script i modified:
http://www.autohotkey.com/forum/viewtopic.php?t=5186
Also you would have to dl the images for the autoscroll icons:
http://www.almondcroissant.com/Images.zip and place them in C:\mouse_images or wherever you want (just modify the script with new location)
Code:
DetectHiddenWindows, On
CoordMode, Mouse, Screen
;// AutoScroll: Root Directory for images
as_imageroot = C:\mouse_images
;// AutoScroll: One acceleration notch in pixels
as_notch = 20
;// Bind Middle Mouse Button to AutoScroll
$XButton1::GoSub, MouseButtonHandler
XButton2::Send, {BROWSER_BACK}
;// Mouse Button Handler Function.
;// Any windows that you don't want AutoScroll to function in
;// can be filtered out here. I've filtered out FireFox; it
;// has its own AutoScroll mode.
MouseButtonHandler:
MouseGetPos, mbh_x, mbh_y, mbh_id, mbh_ctrl, 1
WinGetClass, mbh_class, ahk_id %mbh_id%
if ( mbh_class = "1MozillaUIWindowClass" )
{
MouseClick, Middle
}
else
{
KeyWait, XButton1, T0.15
if ErrorLevel
GoSub, AutoScroll
else
MouseClick, Middle
}
return
;// Main AutoScroll Function
AutoScroll:
;// Store the point where the button was clicked
as_startx = %mbh_x%
as_starty = %mbh_y%
;// Figure out the center point of the image
as_splashx := ( as_startx - 10 )
as_splashy := ( as_starty - 10 )
;// Provide the first image name
as_image = center
;// Initialize some values
as_xlast = 0
as_ylast = 0
as_xlastvector = 0
as_ylastvector = 0
Loop
{
as_changed = 0
;// Get the latest mouse position
MouseGetPos, as_x, as_y
;// Break out of the loop if the Left Mouse Button is clicked
; GetKeyState, as_state, LButton, P
; if as_state = D
; break
;//break ouf of loop if XButton1 is depressed
GetKeyState, as_state2, XButton1, P
if as_state2 = U
break
if as_x != %as_xlast%
{
as_xvector := round((as_startx - as_x)/100)
if as_xvector != %as_xlastvector%
{
as_xspeed := 10 // Abs(as_xvector)
if as_xvector = 0
SetTimer, AutoScrollX, Off
else
SetTimer, AutoScrollX, %as_xspeed%
as_xlastvector = %as_xvector%
}
as_xlast = %as_x%
as_changed = 1
}
if as_y != %as_ylast%
{
as_yvector := round((as_starty - as_y)/as_notch)
as_yvector := (as_yvector * Abs(as_yvector))
if as_yvector != %as_ylastvector%
{
if as_yvector = 0
{
SetTimer, AutoScrollY, Off
}
else
{
as_yspeed := ((400 // Abs(as_yvector)) + 1)
SetTimer, AutoScrollY, %as_yspeed%
}
as_ylastvector = %as_yvector%
}
as_ylast = %as_y%
as_changed = 1
}
;// Update the image if necessary
if as_changed = 1
{
if (as_xvector=0 and as_yvector=0)
as_image = center
else if (as_xvector=0 and as_yvector>0)
as_image = n
else if (as_xvector=0 and as_yvector<0)
as_image = s
else if (as_xvector>0 and as_yvector=0)
as_image = w
else if (as_xvector<0 and as_yvector=0)
as_image = e
else if (as_xvector<0 and as_yvector>0)
as_image = ne
else if (as_xvector>0 and as_yvector>0)
as_image = nw
else if (as_xvector>0 and as_yvector<0)
as_image = sw
else if (as_xvector<0 and as_yvector<0)
as_image = se
if as_image != %as_lastimage%
{
SplashImage, %as_imageroot%\%as_image%.bmp, b X%as_splashx% Y%as_splashy% Hide, , , autoscrollsplash
WinSet, TransColor, FF00FF , autoscrollsplash
SplashImage, Show, , , , autoscrollsplash
as_lastimage = %as_image%
}
}
sleep, 10
}
GoSub, AutoScrollQuit
return
AutoScrollY:
ControlGetFocus, asy_control, A
if as_yvector > 0
MouseClick, WU
else
MouseClick, WD
return
AutoScrollX:
ControlGetFocus, asx_control, A
if as_xvector > 0
SendMessage, 0x114, 0, 0, %asx_control%, A
else
SendMessage, 0x114, 1, 0, %asx_control%, A
return
AutoScrollQuit:
SplashImage, Off
SetTimer, AutoScrollY, Off
SetTimer, AutoScrollX, Off
return