Jump to content
Sign in to follow this  
L3G3NdKillEr

mouse speed

Recommended Posts

L3G3NdKillEr

i want to Increase the mouse speed if any hotkeyset key pressed.

#include<Misc.au3>

HotKeySet("{UP}", "_UpArrow")
HotKeySet("{DOWN}", "_DownArrow")
HotKeySet("{LEFT}", "_LeftArrow")
HotKeySet("{RIGHT}", "_RightArrow")
HotKeySet("{F10}", "_Exit")

While 1
    Sleep(100)
WEnd


Func _UpArrow()
    Local $MousePos = MouseGetPos()
    If _IsPressed(10) Then
        $i = 10
    Else
        $i = 1
    EndIf
    
    If $MousePos[1] > 0 Then
        MouseMove($MousePos[0], $MousePos[1] - $i)
    EndIf
EndFunc   ;==>_UpArrow

Func _DownArrow()
    If _IsPressed(10) Then
        $i = 10
    Else
        $i = 1
    EndIf

    Local $MousePos = MouseGetPos()
    If $MousePos[1] < @DesktopHeight Then
        MouseMove($MousePos[0], $MousePos[1] + $i)
    EndIf
EndFunc   ;==>_DownArrow

Func _LeftArrow()
    If _IsPressed(10) Then
        $i = 10
    Else
        $i = 1
    EndIf

    Local $MousePos = MouseGetPos()
    If $MousePos[0] > 0 Then
        MouseMove($MousePos[0] - $i, $MousePos[1])
    EndIf
EndFunc   ;==>_LeftArrow

Func _RightArrow()
    If _IsPressed(10) Then
        $i = 10
    Else
        $i = 1
    EndIf
    

    Local $MousePos = MouseGetPos()
    If $MousePos[0] < @DesktopWidth Then
        MouseMove($MousePos[0] + $i, $MousePos[1])
    EndIf
EndFunc   ;==>_RightArrow

Func _Exit()
    Exit
EndFunc   ;==>_Exit

i'm very responsible, when ever something goes wrong they always say I'm responsible.Life is like an Adventure... BUT COOL GRAPHICS<====================----=LEGEND KILLER=----=========================>

Share this post


Link to post
Share on other sites
Monamo

i want to Increase the mouse speed if any hotkeyset key pressed.

#include<Misc.au3>

HotKeySet("{UP}", "_UpArrow")
HotKeySet("{DOWN}", "_DownArrow")
HotKeySet("{LEFT}", "_LeftArrow")
HotKeySet("{RIGHT}", "_RightArrow")
HotKeySet("{F10}", "_Exit")

While 1
    Sleep(100)
WEnd
Func _UpArrow()
    Local $MousePos = MouseGetPos()
    If _IsPressed(10) Then
        $i = 10
    Else
        $i = 1
    EndIf
    
    If $MousePos[1] > 0 Then
        MouseMove($MousePos[0], $MousePos[1] - $i)
    EndIf
EndFunc   ;==>_UpArrow

Func _DownArrow()
    If _IsPressed(10) Then
        $i = 10
    Else
        $i = 1
    EndIf

    Local $MousePos = MouseGetPos()
    If $MousePos[1] < @DesktopHeight Then
        MouseMove($MousePos[0], $MousePos[1] + $i)
    EndIf
EndFunc   ;==>_DownArrow

Func _LeftArrow()
    If _IsPressed(10) Then
        $i = 10
    Else
        $i = 1
    EndIf

    Local $MousePos = MouseGetPos()
    If $MousePos[0] > 0 Then
        MouseMove($MousePos[0] - $i, $MousePos[1])
    EndIf
EndFunc   ;==>_LeftArrow

Func _RightArrow()
    If _IsPressed(10) Then
        $i = 10
    Else
        $i = 1
    EndIf
    

    Local $MousePos = MouseGetPos()
    If $MousePos[0] < @DesktopWidth Then
        MouseMove($MousePos[0] + $i, $MousePos[1])
    EndIf
EndFunc   ;==>_RightArrow

Func _Exit()
    Exit
EndFunc   ;==>_Exit

I still haven't found the method to speed it up, that's why I added the SHIFT key modifiers to jump 10 pixels instead of one. I'll gladly update the code if you find anything.

HotKeySet("{INS}", "_ShowInfo")

HotKeySet("+{UP}", "_UpArrow")

HotKeySet("{UP}", "_UpArrow")

HotKeySet("+{DOWN}", "_DownArrow")

HotKeySet("{DOWN}", "_DownArrow")

HotKeySet("+{LEFT}", "_LeftArrow")

HotKeySet("{LEFT}", "_LeftArrow")

HotKeySet("+{RIGHT}", "_RightArrow")

HotKeySet("{RIGHT}", "_RightArrow")

HotKeySet("{F10}", "_Exit")


- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Share this post


Link to post
Share on other sites
ssubirias3

i want to Increase the mouse speed if any hotkeyset key pressed.

You're joking right??

Your code uses the MouseMove() function and you don't know its parameters??? How do you even know you are using the function correctly? What does the Help file say if you search the keywords "mouse speed"??

Edit: @Monamo - the above was not directed toward you, you're good you. Its amazing to me how people will not a. take time to understand the functions and Help file examples, b. Use other people's code without trying to figure out functions used, and c. explain what they have done, what they expected to happen, or what something in the Help or example code means. I'm all about helping people, but they first have to show they've tried to figure it out. I'll be the first to code something for a new person if they've put forth an effort.

That said, Mo... have you looked at "MouseClickDragDelay" This Opt() will alters the length of the brief pause at the start and end of a mouse drag operation.

Time in milliseconds to pause (default=250). Or use 0 for the speed since it will move the mouse instantly.

Edited by ssubirias3

Share this post


Link to post
Share on other sites
Monamo

You're joking right??

Your code uses the MouseMove() function and you don't know its parameters??? How do you even know you are using the function correctly? What does the Help file say if you search the keywords "mouse speed"??

Aye, I've been looking at adjusting the speed incrementally based upon how long the HotKey is pressed, but my results so far have been choppy mouse movement. I'm assuming this is tied to the Sleep tossed in the While, but, even with low memory utilization, it bugged me when I'd end up with 50% CPU spikes since I had intended the keyboard mousemove as an inclusion for other script tasks.


- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Share this post


Link to post
Share on other sites
Monamo

I've updated my script to include a speed increase for when the arrow keys are held down. Give it a shot here.


- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Share this post


Link to post
Share on other sites
ssubirias3

I've updated my script to include a speed increase for when the arrow keys are held down. Give it a shot here.

You've done a good job with this so far Mo! Great job thinking to use _IsPressed() for this script. An idea might be to use the Shif key and Contrl keys to slow the mouse down instead. I'll take a look at the other thread but its looking good. Also you can increase the Sleep(500) without affecting the effect. Might not be necessary but an option if you think the CPU is getting hit too hard.

#include <Misc.au3>
HotKeySet("^{UP}", "_UpArrow")  
HotKeySet("+{UP}", "_UpArrow")  
HotKeySet("{UP}", "_UpArrow")

Func _UpArrow()
     $i = 30                          ;; Moves 30 pixels at a time
     If _IsPressed(10) Then $i = 15   ;; Moves 15 pixels at a time w/ Shift
     If _IsPressed(11) Then $i = 1    ;; Moves 1 pixels at a time w/ Ctrl
     $MousePos = MouseGetPos()
     If $MousePos[1] > 0 Then MouseMove($MousePos[0], $MousePos[1] - $i, 1)
EndFunc   ;==>_UpArrow

Edit: corrected typos

Edited by ssubirias3

Share this post


Link to post
Share on other sites
L3G3NdKillEr

thanx All of you for helpn me :)


i'm very responsible, when ever something goes wrong they always say I'm responsible.Life is like an Adventure... BUT COOL GRAPHICS<====================----=LEGEND KILLER=----=========================>

Share this post


Link to post
Share on other sites
Paulie

You've do a ood job with this so far Mo! Great job thinking to use _IsPressed() for this script. An idea might be to use the Shif key and Contrl keys to slow the mouse down instead. I'll take a look at the other thread but its looking good. Also you can increase the Sleep(500) without affecting the effect. Might not be necessary but an option if you think the CPU is getting hit too hard.

#include <Misc.au3>
HotKeySet("^{UP}", "_UpArrow")  
HotKeySet("+{UP}", "_UpArrow")  
HotKeySet("{UP}", "_UpArrow")

Func _UpArrow()
     $i = 30                          ;; Moves 30 pixels at a time
     If _IsPressed(10) Then $i = 15   ;; Moves 15 pixels at a time w/ Shift
     If _IsPressed(11) Then $i = 1    ;; Moves 1 pixels at a time w/ Ctrl
     $MousePos = MouseGetPos()
     If $MousePos[1] > 0 Then MouseMove($MousePos[0], $MousePos[1] - $i, 1)
EndFunc   ;==>_UpArrowoÝ÷ Ûú®¢×jÊËa¢è!¶Øb³¬r%b~'Ö¥Ûey«­¢+Ø¥¹±Õ±Ðí5¥Í¹ÔÌÐì)±½°ÀÌØí
½Õ¹Ð)]¡¥±Ä($ÀÌØíA½Ìô5½ÕÍÑA½Ì ¤(%Q½½±Q¥À ÀÌØí¤°À°À¤($íUÀ(%%}%ÍAÉÍÍ Èؤѡ¸($$ÀÌØí¤ôÄ($%]¡¥±}%ÍAÉÍÍ Èؤ($$$ÀÌØíA½Ìô5½ÕÍÑA½Ì ¤($$$ÀÌØí½Õ¹Ðô9½ÐÀÌØí
½Õ¹Ð($$%%ÀÌØí
½Õ¹ÐÑ¡¸ÀÌØí¤¬ôÄ($$%5½ÕÍ5½Ù ÀÌØíA½ÍlÁt°ÀÌØíA½ÍlÅt´ÀÌØí¤°À¤($$%M±À ÈÔ¤($$%Q½½±Q¥À ÀÌØí¤°À°À¤($%]¹(%¹%($í½Ý¸(%%}%ÍAÉÍÍ Èà¤Ñ¡¸($$ÀÌØí¤ôÄ($%]¡¥±}%ÍAÉÍÍ Èà¤($$$ÀÌØíA½Ìô5½ÕÍÑA½Ì ¤($$$ÀÌØí½Õ¹Ðô9½ÐÀÌØí
½Õ¹Ð($$%%ÀÌØí
½Õ¹ÐÑ¡¸ÀÌØí¤¬ôÄ($$%Q½½±Q¥À ÀÌØí¤°À°À¤($$%M±À ÈÔ¤($$%5½ÕÍ5½Ù ÀÌØíA½ÍlÁt°ÀÌØíA½ÍlÅt¬ÀÌØí¤°À¤($%]¹(%¹%($í1Ð(%%}%ÍAÉÍÍ ÈԤѡ¸($$ÀÌØí¤ôÄ($%]¡¥±}%ÍAÉÍÍ ÈÔ¤($$$ÀÌØíA½Ìô5½ÕÍÑA½Ì ¤($$$ÀÌØí½Õ¹Ðô9½ÐÀÌØí
½Õ¹Ð($$%%ÀÌØí
½Õ¹ÐÑ¡¸ÀÌØí¤¬ôÄ($$%5½ÕÍ5½Ù ÀÌØíA½ÍlÁt´ÀÌØí¤°ÀÌØíA½ÍlÅt°À¤($$%M±À ÈÔ¤($$%Q½½±Q¥À ÀÌØí¤°À°À¤($%]¹(%¹%($íI¥¡Ð(%%}%ÍAÉÍÍ Èܤѡ¸($$ÀÌØí¤ôÄ($%]¡¥±}%ÍAÉÍÍ Èܤ($$$ÀÌØíA½Ìô5½ÕÍÑA½Ì ¤($$$ÀÌØí½Õ¹Ðô9½ÐÀÌØí
½Õ¹Ð($$%%ÀÌØí
½Õ¹ÐÑ¡¸ÀÌØí¤¬ôÄ($$%5½ÕÍ5½Ù ÀÌØíA½ÍlÁt¬ÀÌØí¤°ÀÌØíA½ÍlÅt°À¤($$%M±À ÈÔ¤($$%Q½½±Q¥À ÀÌØí¤°À°À¤($%]¹(%¹%)]¹

Share this post


Link to post
Share on other sites
L3G3NdKillEr

@paulie

do u notice that it has an error of variable used without being declared. at tooltip.


i'm very responsible, when ever something goes wrong they always say I'm responsible.Life is like an Adventure... BUT COOL GRAPHICS<====================----=LEGEND KILLER=----=========================>

Share this post


Link to post
Share on other sites
Paulie

@paulie

do u notice that it has an error of variable used without being declared. at tooltip.

Yeah i meant to remove all the tooltips.... That was from my editing...

Share this post


Link to post
Share on other sites
L3G3NdKillEr

oh i did'nt notice that. :)


i'm very responsible, when ever something goes wrong they always say I'm responsible.Life is like an Adventure... BUT COOL GRAPHICS<====================----=LEGEND KILLER=----=========================>

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×