Sign in to follow this  
Followers 0
EuphoricApathy

NOOB HELP : GUI for Random Auto Clicker

3 posts in this topic

#1 ·  Posted (edited)

Im new,if you cant tell. I'd like some help making a GUI for the script i recently had help creating that clicks randomly within a set of coordinates(The applications of such a program are questionable i guess,but i can think of a few that people would use it for...for example,i recently used it with an on screen keyboard to generate random sets of letters and numbers,im sure others can find more uses for such a program and thats why id like to create it.). Thread can be found here :



Im VERY new,so if someone can kind of walk me through this step by step that would be very very helpful and it would definitely encourage me to keep coding with autoit in the future.

Here is the code i have so far:
 

func exitthescript()
   Exit
EndFunc

HotKeySet( "{ESC}", "exitthescript" )

while 1
   $posx = Random(197, 610)
   $posy = Random(210, 623)
   $posx2 = Random(197, 610)
   $posy2 = Random(210, 623)

   MouseClick("left", $posx, $posy, 1 ,0)
   MouseClick("left", $posx2, $posy2, 1 ,1)

   MouseClick("left",345,693, 1 , 2)

   WEnd

and this works as is if you manually tweak the script for the coordinates for x and y for different sized random clicking areas. But id like to make it a bit easier by creating a GUI that you can just enter your coordinates and set options and stuff like that...

Here is an example of the gui id like to create :

2ntafwl.png

in all fairness,for the base gui image up there, i used the basic setup of a similar program that does some of the same things (and a lot more) that costs money,made by murgee or something like that. Anyways mine is different than theirs so i dont think there should be any problems there.

From what ive read so far you can use a program called KODA to generate autoit Gui's so i just got done downloading that and have no idea how to use it,lol...

Anyways thats about it. To me this is kind of a big project because i know so little,hopefully to the more experienced this is easier... As you can see the GUI has some options that i dont have in my code(and dont know how to code yet) that i need some help figuring out too... So to whoever can help me on this i thank you very very much.

EDIT: just spent some time playing with KODA,here is what i have so far for a gui(have no idea how to  set this all up with my auotit script) http://www.mediafire.com/download/8pb214xpoohxxkx/Random+Auto+Clicker+GUI.kxf

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=*Random Auto Clicker GUI.kxf
$Form1 = GUICreate("Random Auto Clicker By : Euphoric Apathy", 542, 293, 192, 124)
$Label1 = GUICtrlCreateLabel("Where to Click?", 8, 8, 80, 17)
$Radio1 = GUICtrlCreateRadio("Random Location within given below rectangular area", 8, 32, 281, 25)
$Edit1 = GUICtrlCreateEdit("", 40, 56, 113, 25, BitOR($ES_CENTER,$ES_AUTOHSCROLL,$ES_WANTRETURN,$WS_VSCROLL))
GUICtrlSetData(-1, "Edit1")
GUICtrlSetTip(-1, "0")
$Label2 = GUICtrlCreateLabel("X :", 8, 64, 17, 17)
$Label3 = GUICtrlCreateLabel("Width :", 0, 96, 38, 17)
$Edit2 = GUICtrlCreateEdit("", 42, 89, 113, 25, BitOR($ES_CENTER,$ES_AUTOHSCROLL,$ES_WANTRETURN,$WS_VSCROLL))
GUICtrlSetData(-1, "Edit1")
GUICtrlSetTip(-1, "0")
$Edit3 = GUICtrlCreateEdit("", 235, 55, 113, 25, BitOR($ES_CENTER,$ES_AUTOHSCROLL,$ES_WANTRETURN,$WS_VSCROLL))
GUICtrlSetData(-1, "Edit1")
GUICtrlSetTip(-1, "0")
$Edit4 = GUICtrlCreateEdit("", 237, 85, 113, 25, BitOR($ES_CENTER,$ES_AUTOHSCROLL,$ES_WANTRETURN,$WS_VSCROLL))
GUICtrlSetData(-1, "Edit1")
GUICtrlSetTip(-1, "0")
$Label4 = GUICtrlCreateLabel("Y :", 200, 56, 17, 17)
$Label5 = GUICtrlCreateLabel("Height : ", 184, 88, 44, 17)
$Label6 = GUICtrlCreateLabel("Select Click Type", 8, 136, 87, 17)
$Radio2 = GUICtrlCreateRadio("Left Click", 8, 152, 73, 33)
$Radio3 = GUICtrlCreateRadio("Right Click", 8, 176, 73, 33)
$Radio4 = GUICtrlCreateRadio("Left Double click", 8, 254, 129, 33)
$Radio5 = GUICtrlCreateRadio("Right Double Click", 8, 231, 113, 33)
$Radio6 = GUICtrlCreateRadio("Middle Button Click", 8, 204, 121, 33)
$Label7 = GUICtrlCreateLabel("Delay Between Clicks", 144, 128, 107, 17)
$Radio7 = GUICtrlCreateRadio("Random Delay Between Clicks", 144, 144, 177, 25)
$Edit5 = GUICtrlCreateEdit("", 145, 173, 89, 25, BitOR($ES_CENTER,$ES_AUTOHSCROLL,$ES_WANTRETURN,$WS_VSCROLL))
GUICtrlSetData(-1, "Edit1")
GUICtrlSetTip(-1, "0")
$Label8 = GUICtrlCreateLabel("And", 240, 176, 23, 17)
$Edit6 = GUICtrlCreateEdit("", 267, 173, 65, 25, BitOR($ES_CENTER,$ES_AUTOHSCROLL,$ES_WANTRETURN,$WS_VSCROLL))
GUICtrlSetData(-1, "Edit1")
GUICtrlSetTip(-1, "0")
$Combo1 = GUICtrlCreateCombo("", 344, 176, 97, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
$Radio8 = GUICtrlCreateRadio("Fixed Delay Between Clicks", 144, 208, 169, 25)
$Edit7 = GUICtrlCreateEdit("", 145, 234, 81, 25, BitOR($ES_CENTER,$ES_AUTOHSCROLL,$ES_WANTRETURN,$WS_VSCROLL))
GUICtrlSetData(-1, "Edit1")
GUICtrlSetTip(-1, "0")
$Combo2 = GUICtrlCreateCombo("", 230, 240, 97, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
$Label9 = GUICtrlCreateLabel("Start/Stop Hotkey", 384, 24, 90, 17)
$Input1 = GUICtrlCreateInput("Input1", 384, 40, 113, 21)
$Button1 = GUICtrlCreateButton("Assign", 384, 64, 113, 25)
$Button2 = GUICtrlCreateButton("Hide To System Tray", 392, 240, 137, 41)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd
Edited by EuphoricApathy

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

KODA makes the GUI for your script and thats it, the logic is up to you... 

example:

one of your controls is a button:

$Button1 = GUICtrlCreateButton("Assign", 384, 64, 113, 25)

 

The portion of your script that will look for something to happen will be your While loop:

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

If we want your button to do something, we add it as a case statement, and your while loop looks like this:

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
             Makeabox()

    EndSwitch
WEnd

that will call the MakeaBox function, which doesnt exist until you add it, so add this(best to add after the wend:

Func Makeabox()
Msgbox(0,"Hey","this is a popup box.")
endfunc

Now when someone presses that button, they will get a popup.

 

Not to sound like an ass, but you may be biting off more than you can chew.

You may want to start small and work your way up.

Hope that all helps.

Edited by Kovacic

C0d3 is P0etry( ͡° ͜ʖ ͡°)

Share this post


Link to post
Share on other sites

on a side note, throw this at the top of your script, it will fix the label overlapping the inputs looking funky.

GUICtrlSetDefBkColor($GUI_BKCOLOR_TRANSPARENT)

C0d3 is P0etry( ͡° ͜ʖ ͡°)

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