Sign in to follow this  
Followers 0
matrix10657

Gui input boxes

2 posts in this topic

I'm trying to make a gui that will allow you to enter in a bunch of different information. On this gui there will be an execute button, when it is pressed a pre-written script will go and at the appropriate times I want the data previously entered in the gui to be typed by auto it.

#include <GuiConstants.au3>
GuiCreate(".bot", 400, 400)
$name1 = GuiCtrlCreateInput("Name", 50, 50, 130, 20)
$gobutton = GuiCtrlCreateButton("Go!", 10, 330, 100, 30)
GUISetState()
while 1
sleep (5000)
wend

This is where I left off on my gui. I want to beable to enter 'bob' into my input box and when I press 'Go!' ....

mouseclick ("left",502,187,1,0.0001)
mouseclick ("left",440,209,1,0.0001)
mouseclick ("left",218,200,1,0.0001)
mouseclick ("left",163,166,1,0.0001)
mouseclick ("left",66,142,1,0.0001)
mouseclick ("left",283,306,1,0.0001)
mouseclick ("left",610,210,1,0.0001)
mouseclick ("left",633,117,1,0.0001)
mouseclick ("left",656,117,1,0.0001)
mouseclick ("left",713,332,1,0.0001)
mouseclick ("left",273,321,1,0.0001)
mouseclick ("left",555,466,1,0)
sleep (500)
pixelsearch (306,379,308,381,0xFFFFFF)
if @error Then
    sleep (500)
    mouseclick ("left",323,380,1,0)
    EndIf
if not @error then
    mouseclick ("left",323,380,1,0)
EndIf
mouseclick ("left",28,555,1,0)
sleep (400)
mousemove (99,467,2)
mouseclick ("left",120,447,1,2)
mouseclick ("left",439,44,5,.5)
mouseclick ("left",281,216,1,0)
sleep (5000)
pixelsearch (379,42,381,44,0xFFFFFF)
if @error Then
    $do = 0
Else
    $do = 1
EndIf
Do
    sleep (500)
    pixelsearch (379,42,381,44,0xFFFFFF)
        if @error Then
        $do = 0
    Else
        $do = 1
    EndIf
until $do = 0
sleep (200)
mouseclick ("left",352,285,1,1)
sleep (200)
mouseclick ("left",107,136,1,0)
mousemove (258,205,0)
send ("{BS 16}")
send("GUICtrlRead($name1)")

Right at this part I would like it to send ("bob"). However, I do not know The correct way to format the gui and the script.

Thanks in advance

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Try this:

#include <GuiConstants.au3>
GuiCreate("MSBot", 200, 150)
$name1 = GuiCtrlCreateInput("", 35, 50, 130, 20)
$gobutton = GuiCtrlCreateButton("Go!", 50, 90, 100, 30)
GUISetState()
While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $gobutton
            If GUICtrlRead($name1) = "" Then
                MsgBox(0, "ERROR!", "You must input a name!")
            Else
                $NAME = GUICtrlRead($name1)
                GoButton()
            EndIf
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
Wend

Func GoButton()
    MouseClick ("left",502,187,1,1)
    MouseClick ("left",440,209,1,1)
    MouseClick ("left",218,200,1,1)
    MouseClick ("left",163,166,1,1)
    MouseClick ("left",66,142,1,1)
    MouseClick ("left",283,306,1,1)
    MouseClick ("left",610,210,1,1)
    MouseClick ("left",633,117,1,1)
    MouseClick ("left",656,117,1,1)
    MouseClick ("left",713,332,1,1)
    MouseClick ("left",273,321,1,1)
    MouseClick ("left",555,466,1,1)
    Sleep (500)
    PixelSearch (306,379,308,381,0xFFFFFF)
    If @error Then
        Sleep (500)
        MouseClick ("left",323,380,1,1)
    EndIf
    If Not @error Then
        MouseClick ("left",323,380,1,1)
    EndIf
    MouseClick ("left",28,555,1,1)
    Sleep (400)
    MouseMove (99,467,2)
    MouseClick ("left",120,447,1,1)
    MouseClick ("left",439,44,5,1)
    MouseClick ("left",281,216,1,1)
    Sleep (5000)
    PixelSearch (379,42,381,44,0xFFFFFF)
    If @error Then
        $do = 0
    Else
        $do = 1
    EndIf
    Do
        Sleep (500)
        PixelSearch (379,42,381,44,0xFFFFFF)
        If @error Then
            $do = 0
        Else
            $do = 1
        EndIf
    Until $do = 0
    Sleep (200)
    MouseClick ("left",352,285,1,1)
    Sleep (200)
    MouseClick ("left",107,136,1,1)
    MouseMove (258,205,1)
    Send ("{BS 16}")
    Send($NAME)
EndFunc

EDIT: Just re-read your post... you'll have to change the GUI size back to something bigger if you plan to add more controls, but it works for now.

EDIT EDIT: BTW please post in the correct forum next time. I see that you quite new to the forums, but that doesn't make it ok for you to post GUI support question in the AutoItX Help and Support forums. Please be careful where you are when you press the "New Topic" button. Thanks and welcome to the forums!

Edited by dandymcgee

- Dan [Website]

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