Jump to content

How to do


Recommended Posts

Ok heres what im try to achieve.

Based on the amount the user enters into the input box the script will run that many times.

Now the script has to move the mouse down -2 y every time based on the amount entered and x has to remain the same. How can i achieve this without making a incredibly long IF statement?

Link to comment
Share on other sites

Ok heres what im try to achieve.

Based on the amount the user enters into the input box the script will run that many times.

Now the script has to move the mouse down -2 y every time based on the amount entered and x has to remain the same. How can i achieve this without making a incredibly long IF statement?

This does what you say... (I'm assuming by -2 y you mean down? if not change the + to -)

$Num = InputBox("Runs", "How many times?", 1)
$Start = MouseGetPos()
For $i = 1 To $Num
    MouseMove($Start[0], $Start[1] + 2)
    $Start = MouseGetPos()
Next

We ought not to misbehave, but we should look as though we could.

Link to comment
Share on other sites

Good example above.

To expand on that example, you may need to block user input so they may not interfere with the mouse moves. Also, we should check if the mouse will hit the bottom of the screen before the looping is done, and if so, change the amount of loops to what would hit the bottom of the screen.

#RequireAdmin ; For BlockInput()
$Num = InputBox("Runs", "How many times?", 1)
BlockInput(1) ; Block user control of mouse and keyboard
;~ Check if $num is set too high and will cause the mouse to hit the end of the screen early.
If MouseGetPos(1) + ($Num * 2) > @DesktopHeight Then $Num = Int((@DesktopHeight - MouseGetPos(1)) / 2)
For $i = 1 To $Num
    MouseMove(MouseGetPos(0), MouseGetPos(1) + 2)
Next
BlockInput(0)
Link to comment
Share on other sites

  • 2 weeks later...

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
 Share

  • Recently Browsing   0 members

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