Sign in to follow this  
Followers 0
pnut

Improving my first script

7 posts in this topic

Hey there I've just made a script that clicks randomly around the screen and pressing Alt+Q at the same time. Having this done, I felt a sense of achievement for myself. I would like some ideas for improvements like a GUI. ;) This script is pretty basic -

#notrayicon
HotKeySet("{F11}", "_exit")
$delay = 500
Break(0)
While 1
Sleep($delay)
MouseMove(Random(0, @DesktopWidth), Random(0, @DesktopHeight), 0)
Send("ALTQ")
Sleep($delay)
WEnd
Func _exit()
Break(1)
Exit
EndFunc

If possible i want the script to continuously click ALT+Q while clicking the screen at 0.5 second interval.

Much thanks from me :whistle:

Share this post


Link to post
Share on other sites



just before the while loop use...

AdlibEnable ( "function" [, time] )

and place the send() command inside the function..

see help

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Oh thx I'm kinda new into this, btw how do u make specific mouseclicks. For example, i want it to click at the top of my screen and the bottom of my screen, and how do i get coordinates.

Share this post


Link to post
Share on other sites

0 = top of screen

@DesktopHeight = bottom of screen

use MouseClick() - see help

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Sorry for the trouble but what about a specific location of the screen? I'd like to know how to get coordinates

Share this post


Link to post
Share on other sites

use the autoit window info that comes with autoit or run this

press the home key and it will copy the coords to the clipboard in the format x,y

HotKeySet("{Home}","capture")
HotKeySet("{Esc}","quit")
While 1
    Sleep(25)
    $pos = MouseGetPos()
    ToolTip("x = " & $pos[0] & "," & "y = " & $pos[1],$pos[0] + 10,$pos[1] + 10)
WEnd

Func capture()
    ClipPut($pos[0] & "," & $pos[1])
EndFunc

Func quit()
    Exit
EndFunc

Share this post


Link to post
Share on other sites

Hey thanks man.

Btw i made a new script-

#notrayicon
HotKeySet("{F11}", "_exit")
Break(0)
While 1
MouseClick("left")
Sleep(200)
Send ("!q")
WEnd
Func _exit()
Break(1)
Exit
EndFunc

Basically its something to prevent me from getting kicked in a game for being inactive.

I'd like to know how can i make the script run without even playing the game. For example, i run the script and i do not have to switch to my game screen for it to work. Probably it require WaitWinActive function but i don't know how to use it.

I'm asking this as i have to be away in a game doing projects with my friends.

Thanks again :whistle:

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