Havent been active for a while.
Just made a useless script that bounses the mouse around.
Not tested on multiple monitors.
It's commented so it should be quite easy to se what evrything does
Important: You stop and exit the script by pressing s
Here is the code:
Spoiler
Code: Select all
#Persistent ;Prevent script from closing
CoordMode, Mouse, Screen ;Set the mouse coordmode to screen
WinGetPos,,, desk_width, desk_height, Program Manager ;Get the screen size
setTimer, mousemove , 1 ;Set a timer, with one miliscond delay
Random, dir, 1,4 ;Randomize the dir variable
spd = 1 ;Beginning speed
return
mousemove:
{
MouseGetPos, xpos, ypos ;Get current mouse posistion
;Top side bounce
if (dir = 1 and ypos = 0) ;Check if the mouse is moving up and to the left and hits the top of the screen
{
dir = 4 ;Change direction to Down and to the left
}
if (dir = 2 and ypos = 0) ;Check if the mouse is moving up and to the right and hits the top of the screen
{
dir = 3 ;Change the direction to Down and to the right
}
;Left side
if (dir = 1 and xpos = 0) ;Check if the mouse if moving up and to the left and hits the left side of the screen
{
dir = 2 ;Change direction to Up and to the right
}
if (dir = 4 and xpos = 0) ;Check if the mouse is moving down and to the left and hits the left side of the screen
{
dir = 3 ;Change the direction to Down and to the right
}
; Right side bounces
if (dir = 2 and xpos = desk_width - 1) ;Check if the mouse is moving up and to the right and hits the right side of the screen
{
dir = 1 ;Change the direction to Up and to the left
}
if (dir = 3 and xpos = desk_width - 1) ;Check if the mouse is moving Down and to the right and hits the right side of the screen
{
dir = 4 ;Change direction to Down and to the left
}
;Bottom side
if (dir = 3 and ypos = desk_height - 1) ;Check if the mouse is moving Down and to the right and hits the bottom of the screen
{
dir = 2 ;Change direction to Up and to the right
}
if (dir = 4 and ypos = desk_height - 1) ;Check if the mouse is moving Down and to the left and hits the bottom of the screen
{
dir = 1 ;Change the direction to Up and to the left
}
;Move the mouse
if (dir = 1) ;Check if the mouse should move up and to the left
{
mousemove, -spd,-spd,1, R ;Move the mouse, relative to current location, up and to the left, with the speed indicated by the variable spd
}
if (dir = 2)
{
mousemove, spd,-spd,1, R ;Move the mouse, relative to current location, up and to the right, with the speed indicated by the variable spd
}
if (dir = 3)
{
mousemove, spd,spd,1, R ;Move the mouse, relative to current location, down and to the right, with the speed indicated by the variable spd
}
if (dir = 4)
{
mousemove, -spd,spd,1, R ;Move the mouse, relative to current location, down and to the left, with the speed indicated by the variable spd
}
spd++ ;Increese the speed each time the timer is run, comment this line to keep speed constant
}
s::exitapp ;Exit the script and stop moving the mouse