Sign in to follow this  
Followers 0
MySqlThrashMetal

A beginner problem with hotkeyset that doesn't work

3 posts in this topic




#2 ·  Posted

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

 

Share this post


Link to post
Share on other sites

#3 ·  Posted

Hello ! Thank you very much for your help and tips !

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  
Followers 0