Jump to content

A beginner problem with hotkeyset that doesn't work


Recommended Posts

Can't use "Exit" as a function in HotKeySet. Also, Dim is depreciated and not used much anymore. Try looking at Global and Local for declarations

Global $x = Random(0, @DesktopWidth, 0)
Global $y = Random(0, @DesktopHeight, 0)
HotKeySet("{ESC}", Close)

While 1
    $y = Random(0, @DesktopHeight, 0)
    $x = Random(0, @DesktopWidth, 0)
    Sleep(500)

    MouseMove($x, $y, 10)
WEnd

Func Close()
    Exit
EndFunc

You can also forego the variables all together and just use the Random in the MouseMove function (Plus you used DesktopWidth for Y and DesktopHeight for X, backwards :P)

HotKeySet("{ESC}", Close)

While 1
    Sleep(500)
    MouseMove(Random(0, @DesktopWidth, 0), Random(0, @DesktopHeight, 0), 10)
WEnd

Func Close()
    Exit
EndFunc

 

Link to comment
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
 Share

  • Recently Browsing   0 members

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