Jump to content

Help With GUI


Muchuchu
 Share

Recommended Posts

Alright, I have a program all scripted, and all i need is an interface with a start and stop button. When you hit the start it starts the script, and when you hit the stop it with end the script but keep the interface up as well. Maybe someone can help me out with where to start? I even have downloaded Koda's GUI program, but don't know how to implement it inmto my script very well.

Link to comment
Share on other sites

I got the GUI Password checker from Paulie.

Edit- Also, are you a member of Triad?

#include <GUIConstants.au3>

hotkeyset("{BS}","quit")

$Password = "blank101"

Do

$pass = InputBox("Password Required", "Please Input Your Password.", "", "*")

If $pass == $Password Then

MsgBox(0,"Correct", "Password Correct.")

Else

MsgBox(0,"Invalid", "Password Invalid. Try Again.")

EndIf

Until $Pass == $Password

$i = 0

Dim $arr[2][1000]

do

msgbox(0 , "ChickenKiller" , "Click Ok to start the program")

$i = $i + 1

Until $i = 1

do

do

sleep("3000")

$coord = PixelSearch( 0, 0, 1279, 1023, 0x7B190F);cuts trees

if @ERROR Then

PixelSearch( 0, 0, 1279, 1023, 0x7B190F)

endif

until Not @ERROR

$i = 1

if NOT @error then

$arr[0][$i] = $coord[0]

$arr[1][$i] = $coord[1]

endif

$i = 1

sleep("3000")

MouseMove( $coord[0] , $coord[1])

sleep("700")

mousedown("left")

sleep("400")

mouseup("left")

sleep("8000")

$i = $i + 1

Until $i = 1

$GUI =GUICreate("Your Program window", 200,300)

GUICtrlCreateLabel("Press the X to Close", 50,135)

GUISetState()

While 1

Switch GUIGetMsg()

Case $GUI_EVENT_CLOSE

$pass = InputBox("Password Required", "Please Input Your Password.", "", "*")

If $pass = $Password Then

MsgBox(0,"Correct", "Password Correct. Exiting...")

Exit

Else

MsgBox(0,"Invalid", "Password Invalid. Continuing...")

EndIf

EndSwitch

WEnd

func quit()

exit

endfunc

Edited by Muchuchu
Link to comment
Share on other sites

First... Koda helps you build GUI's... then you have to do the logic.

Second... "When you hit the start it starts the script"... exactly what part are you talking about? Is it this part?

do
do
sleep("3000")
$coord = PixelSearch( 0, 0, 1279, 1023, 0x7B190F);cuts trees

if @ERROR Then
PixelSearch( 0, 0, 1279, 1023, 0x7B190F)
endif

until Not @ERROR
$i = 1
if NOT @error then
$arr[0][$i] = $coord[0]
$arr[1][$i] = $coord[1]
endif
$i = 1

sleep("3000")
MouseMove( $coord[0] , $coord[1])
sleep("700")
mousedown("left")
sleep("400")
mouseup("left")
sleep("8000")

$i = $i + 1

Until $i = 1

I think Zedna's suggestion might help (was posted while typing).

And, yes... I am part of Triad. Why do you ask?

Link to comment
Share on other sites

The artwork you guys created are amazing, I particularly like this piece

http://www.triad-art.com/thumbs/y05_source_triptych_left.jpg

Back on topic Yes that is what I want that script to run once start is pressed. I have the GUI set up but am having trouble with the logic. I tried using an if...then statement but it isn't working. Also, with the GUI, I want to make it so that if they press the "x" on the GUI with the start stop buttons, that it exits out, how do you tell it to do that? Thanks.

Link to comment
Share on other sites

Alright, as far as I can tell, you already have a GUI and I'm not sure what else you want to add. I did remove some of the redundant loops, and double error checking, so that it is slightly easier to read and understand. Let me know if there is something specific you need help with.

#include <GUIConstants.au3>
hotkeyset("{BS}","quit")

$Password = "blank101"
Do
    $pass = InputBox("Password Required", "Please Input Your Password.", "", "*")
    If $pass = $Password Then
        MsgBox(0,"Correct", "Password Correct.")
    Else
        MsgBox(0,"Invalid", "Password Invalid. Try Again.")
    EndIf
Until $Pass = $Password

Dim $arr[2][1000]
msgbox(0 , "ChickenKiller" , "Click Ok to start the program")

do
    sleep("3000")
    $coord = PixelSearch( 0, 0, 1279, 1023, 0x7B190F);cuts trees
    if @ERROR Then
        PixelSearch( 0, 0, 1279, 1023, 0x7B190F)
    endif
until Not @ERROR

$arr[0][$i] = $coord[0]
$arr[1][$i] = $coord[1]

sleep("3000")
MouseMove( $coord[0] , $coord[1])
sleep("700")
mousedown("left")
sleep("400")
mouseup("left")
sleep("8000")


$GUI = GUICreate("Your Program window", 200,300)
GUICtrlCreateLabel("Press the X to Close", 50,135)
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            $pass = InputBox("Password Required", "Please Input Your Password.", "", "*")
            If $pass = $Password Then
                MsgBox(0,"Correct", "Password Correct. Exiting...")
                Exit
            Else
                MsgBox(0,"Invalid", "Password Invalid. Continuing...")
            EndIf
    EndSwitch
WEnd

func quit()
    exit
endfunc
Edited by dandymcgee

- Dan [Website]

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...