Mouse bouncer (Just made for fun)

Post your working scripts, libraries and tools for AHK v1.1 and older
Acuena
Posts: 20
Joined: 27 Jan 2014, 14:56

Mouse bouncer (Just made for fun)

21 Jul 2016, 10:20

Hi!
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
geek
Posts: 1053
Joined: 02 Oct 2013, 22:13
Location: GeekDude
Contact:

Re: Mouse bouncer (Just made for fun)

21 Jul 2016, 12:17

Had to modify it a little bit to work in WINE on Linux (substituted A_ScreenWidth/height for the WinGet) and gave it a run.

http://i.imgur.com/IePpXRz.gifv

Image
User avatar
metacognition
Posts: 117
Joined: 22 Oct 2014, 05:57
Location: Alaska
Contact:

Re: Mouse bouncer (Just made for fun)

22 Jul 2016, 03:02

Image

Real life applications haha!

Nice little code :D

Also nice to see others dabble in porting scripts to wine... Several of my scripts have a wine version and a windows version...
Acuena
Posts: 20
Joined: 27 Jan 2014, 14:56

Re: Mouse bouncer (Just made for fun)

25 Jul 2016, 06:48

Hi!

I made some changes to the code, I don't know if it will work in WINE, I do not have it available here at the computer I am at now.
The changes are the following:
  • Changed "WinGetPos,,, desk_width, desk_height, Program Manager ;Get the screen size" to:

    Code: Select all

    desk_width := A_ScreenWidth
    desk_height := A_ScreenHeight
    Added:

    Code: Select all

    k::Random, dir, 1,4 ;Randomize the dir variable
    
    Now you can press k to change the direction of the mouse by random the dir variable
    Added:

    Code: Select all

    numpadAdd::spd++ ;Increese the spd variable
    numpadSub::spd-- ;Decreese the spd variable
    
    Now you can press numpadadd and numpadsub to increese and decreese the movemnt speed.
Acuena
Posts: 20
Joined: 27 Jan 2014, 14:56

Re: Mouse bouncer (Just made for fun)

25 Jul 2016, 07:20

Added some more.
  • Added a new key, t

    Code: Select all

    t::
    GetKeyState, state, LButton  ; Right mouse button.
    if state = D
    {
    	send, {lbutton up}
    }
    else
    {
    	send, {lbutton down}
    	}
    return
    
    It toggles the left mouse key, usefull if you want to draw some lines in a painting program.

    I also added this to the s key, making it check if the left mouse key is pressed and if it is, release it.

    Code: Select all

    GetKeyState, state, LButton  ; Right mouse button.
    if state = D
    {
    send, {LButton up}
    }
    
    /

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: pgeugene and 47 guests