Jump to content

Recommended Posts

Posted

As bad old vista isn't able too make the mouse movement speed independent of my touchpad movement speed I had to write that little script.

Hotkeys:

Ctrl + arrow up = faster

Ctrl + arrow down = slower

Ctrl + q = exit

Ctrl + o = on/off

Thus i can easily accelerate my touchpad movement speed without changing it every time in the system control. And there are some funny effects for exampe if you slow it down till -1 you have an inverted mouse movement.

Global $FAKTOR = 2
Global $on = 1
HotKeySet("^q", "quit")
HotKeySet("^{DOWN}", "down")
HotKeySet("^{UP}", "up")
HotKeySet("^o", "on")
$oldpos = MouseGetPos()

While 1
    Sleep(25)
    ToolTip("Mouse Acceleration: " & $FAKTOR, 0, 0)
    If $on Then
        $pos = MouseGetPos()
        $xdif = $pos[0] - $oldpos[0]
        $ydif = $pos[1] - $oldpos[1]
        MouseMove($oldpos[0] + $FAKTOR * $xdif, $oldpos[1] + $FAKTOR * $ydif, 0)
        $pos = MouseGetPos()
        $oldpos = $pos
    EndIf
WEnd
Func quit()
    Exit
EndFunc  ;==>quit
Func down()
    $FAKTOR -= 0.1
EndFunc  ;==>down
Func up()
    $FAKTOR += 0.1
EndFunc  ;==>up
Func on()
    If $on Then
        $on = 0
    Else
        $on = 1
    EndIf
EndFunc  ;==>on

"It's easier to disintegrate an atom than a prejudice." (A.Einstein)---------------------------------------------------------------------------My C++ - tools:Tidy tool-->indents your c++ sourceCleanscript --> cleans autoit-code before compiling (co-author: peethebee)My tools:GUIBuilder-->build your window and get the source; german versionMy Games:OnlineGameCenter-->Online Chess and Connect4 with a rtf-chatSnake-->including a level editor to build your own levelsTetris-->the well known game, big funOther things:Tower of Hanoi-->perfect riddler with graphic output

Posted (edited)
  Markus said:

Hmm, I can't test this becuase I am at school, but does this actually work? Looks like it would only work when moving the mouse up.. Edited by Firestorm

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Posted

  Firestorm said:

Hmm, I can't test this becuase I am at school, but does this actually work? Looks like it would only work when moving the mouse up..

Yes it actually works :)

the calculation of the movement that has been done is independent of the direction.

"It's easier to disintegrate an atom than a prejudice." (A.Einstein)---------------------------------------------------------------------------My C++ - tools:Tidy tool-->indents your c++ sourceCleanscript --> cleans autoit-code before compiling (co-author: peethebee)My tools:GUIBuilder-->build your window and get the source; german versionMy Games:OnlineGameCenter-->Online Chess and Connect4 with a rtf-chatSnake-->including a level editor to build your own levelsTetris-->the well known game, big funOther things:Tower of Hanoi-->perfect riddler with graphic output

Posted (edited)

Nice! I like the idea :)

I made a small(?) UDF from that, using CallBacks and timer:

#include <GuiConstantsEx.au3>
#include <Constants.au3>
#include <EditConstants.au3>
#include <MouseAcceleration_UDF.au3>
;

#NoTrayIcon

_MouseSetAcceleration(10)

HotKeySet("^q", "_QuitApp")
HotKeySet("^o", "_OnOffAcceleration")
HotKeySet("^{Up}", "_FactorUp")
HotKeySet("^{Down}", "_FactorDown")

;===== Tray Items Creation Part =====
Opt("TrayMenuMode", 1)
Opt("TrayOnEventMode", 1)

TraySetClick(16)

$EnableAcceleration_TrayItem = TrayCreateItem("Enable Acceleration  (CTRL + O)")
TrayItemSetOnEvent(-1, "_MainTrayEvents")
TrayItemSetState(-1, $GUI_CHECKED)

TrayCreateItem("")

$ShowGUI_TrayItem = TrayCreateItem("Show Main Window")
TrayItemSetOnEvent(-1, "_MainTrayEvents")
TrayItemSetState(-1, $TRAY_DEFAULT)

$Exit_TrayItem = TrayCreateItem(">> Exit << (CTRL + Q)")
TrayItemSetOnEvent(-1, "_MainTrayEvents")

TraySetOnEvent($TRAY_EVENT_PRIMARYDOUBLE, "_MainTrayEvents")
;===== Tray Creation Part =====

;===== GUI Creation Part =====
$hGUI = GUICreate("_MouseSetAcceleration - Demo", 300, 200)

GUISetIcon("main.cpl", 0)

$EnableAcceleration_CheckBox = GUICtrlCreateCheckbox("Enable Acceleration", 20, 10)
GUICtrlSetState(-1, $GUI_CHECKED)

GUICtrlCreateLabel( _
                    "CTRL + Q       = Exit the program" & @LF & _
                    "CTRL + O       = On / Off Acceleration" & @LF & _
                    "CTRL + UP      = Increese Acceleration" & @LF & _
                    "CTRL + DOWN        = Decreese Acceleration", _
                    20, 50, 260, 50)
GUICtrlSetColor(-1, 0x0000FF)

GUICtrlCreateLabel("Set Mouse Acceleration:", 20, 120)

$Factor_Input = GUICtrlCreateInput($iMOUSE_ACCEL_FACTOR, 20, 140, 110, 20, BitOR($ES_LEFT, $ES_AUTOHSCROLL, $ES_READONLY))
$Set_UpDown = GUICtrlCreateUpdown($Factor_Input)

$Close_Button = GUICtrlCreateButton(">> Exit <<", 20, 170, 60, 20)

GUISetState()
;===== GUI Creation Part =====

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE, $Close_Button
            _QuitApp()
        Case $GUI_EVENT_MINIMIZE
            GUISetState(@SW_HIDE)
            TraySetIcon("main.cpl", 0)
            TraySetState(1)
        Case $EnableAcceleration_CheckBox
            _OnOffAcceleration()
        Case $Set_UpDown
            If Number(GUICtrlRead($Factor_Input)) > $iMOUSE_ACCEL_FACTOR Then
                _FactorUp()
            Else
                _FactorDown()
            EndIf
    EndSwitch
WEnd

Func _MainTrayEvents()
    Switch @TRAY_ID
        Case $Exit_TrayItem
            _QuitApp()
        Case $EnableAcceleration_TrayItem
            _OnOffAcceleration()
        Case $TRAY_EVENT_PRIMARYDOUBLE, $ShowGUI_TrayItem
            TraySetState(2)
            GUISetState(@SW_SHOW)
            GUISetState(@SW_RESTORE)
    EndSwitch
EndFunc

Func _OnOffAcceleration()
    If $hCallBack = 0 Then
        _MouseSetAcceleration(10)
        GUICtrlSetState($EnableAcceleration_CheckBox, $GUI_CHECKED)
        TrayItemSetState($EnableAcceleration_TrayItem, $TRAY_CHECKED)
    Else
        _MouseSetAcceleration(0)
        GUICtrlSetState($EnableAcceleration_CheckBox, $GUI_UNCHECKED)
        TrayItemSetState($EnableAcceleration_TrayItem, $TRAY_UNCHECKED)
    EndIf
EndFunc

Func _FactorUp()
    $iMOUSE_ACCEL_FACTOR += 0.1
    
    ;Strage bug :(
    If StringLen($iMOUSE_ACCEL_FACTOR) > 4 Then $iMOUSE_ACCEL_FACTOR = Round($iMOUSE_ACCEL_FACTOR, 2)
    
    GUICtrlSetData($Factor_Input, $iMOUSE_ACCEL_FACTOR)
EndFunc

Func _FactorDown()
    $iMOUSE_ACCEL_FACTOR -= 0.1
    
    ;Strage bug :(
    If $iMOUSE_ACCEL_FACTOR > 0 Or StringLen($iMOUSE_ACCEL_FACTOR) > 4 Then $iMOUSE_ACCEL_FACTOR = Round($iMOUSE_ACCEL_FACTOR, 2)
    
    GUICtrlSetData($Factor_Input, $iMOUSE_ACCEL_FACTOR)
EndFunc

Func _QuitApp()
    _MouseSetAcceleration(0)
    Exit
EndFunc

The UDF itself and this example attachment:

_MouseAcceleration_UDF.zip

With Tray Minimization option: _MouseAcceleration_UDF.zip

Edit: Added option minimize to System Tray.

Edited by MrCreatoR

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

  • 2 weeks later...
Posted

wow thanks i was wondering if i could make my mouse go faster than windows allows a while ago i donwnloaded this and it actually works i like my mouse to move very fast, its a pain because i dont think windows allows you to move it enough, im using an acceleration speed of 3 its great

thanks

F@T3oYCG

Interpreters have great power!Although they live in the shadow of compiled programming languages an interpreter can do anything that a compiled language can do, you just have to code it right.

Posted

lol my screen is only small im only allowed 9.09999999999998

autoit is cool its like a mix of all of the languages that i know, but it helps me to make more advanced stuff with its capabilities, or it will eventually.

the best thing i have made is an edited version of a volume bar display / adjuster which is great but not going to get me very far, i hope to learn the autoit syntax quite quick, i have only been doing it for about 3 hours lol

Interpreters have great power!Although they live in the shadow of compiled programming languages an interpreter can do anything that a compiled language can do, you just have to code it right.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...