Jump to content

Recommended Posts


I was wondering if I could get some help from someone who is a bit more experienced with conditional scripting. :">

I have a GUI window that I am asking user's to type in their First name and Last name. What I am trying to do is have the "OK" button remain disabled until both Input boxes are not empty.

jafrost helped me out with this script (when I was only wanting the Last name box verified):

#include <GuiConstants.au3>
#include <Misc.au3>
Opt("GUIOnEventMode", 1)
$font = "Arial Bold"
GUICreate("", 400, 316, -1, -1, $WS_EX_TOPMOST)
$GUIMainText = GUICtrlCreateLabel("Please type the following information: ", 20, 20, 350, 30)
GUICtrlSetFont(-1, 14, 400, 0, $font)
GUICtrlSetColor($GUIMainText, 0xFF0000)
$LabelFirstName = GUICtrlCreateLabel("First Name:", 20, 70, 350, 20)
GUICtrlSetFont(-1, 12, 400, 0, $font)
$InputFirstName = GUICtrlCreateInput("", 20, 90, 350, 30)
GUICtrlSetFont(-1, 12, 400, 0, $font)
GUICtrlSetColor($InputFirstName, 0x0033FF)
$LabelLastName = GUICtrlCreateLabel("Last Name:", 20, 140, 350, 20)
GUICtrlSetFont(-1, 12, 400, 0, $font)
$InputlastName = GUICtrlCreateInput("", 20, 160, 350, 30)
GUICtrlSetFont(-1, 12, 400, 0, $font)
GUICtrlSetColor($InputlastName, 0x0033FF)
$OKButton6 = GUICtrlCreateButton("OK", 135, 225, 120, 30)
GUICtrlSetOnEvent($OKButton6, "OKButton")
GUICtrlSetState($OKButton6, $GUI_DISABLE)

While 1
    $TypedName = GUICtrlRead($InputlastName)
    If $TypedName <> "" And BitAND(GUICtrlGetState($OKButton6), $GUI_DISABLE) = $GUI_DISABLE Then
        GUICtrlSetState($OKButton6, $GUI_ENABLE)
    ElseIf $TypedName = "" And BitAND(GUICtrlGetState($OKButton6), $GUI_ENABLE) = $GUI_ENABLE Then
        GUICtrlSetState($OKButton6, $GUI_DISABLE)

Func OKButton()
EndFunc   ;==>OKButton

If someone could lend a hand, I would greatly appreciate it! :)

Link to post
Share on other sites

Did you become bored of waiting for replies in your first topic so you just created another one; bump-style ?

Keep it simple for the forum-users and only use one topic so that they don't have to waste time helping you

when you've already gotten help in your other topic. Capiche ?

Post here instead people : http://www.autoitscript.com/forum/index.php?showtopic=39089


SORRY for the trouble. I responded to the earlier thread but wasn't sure if I would get a response since that thread was resolved. :)

OK...I'm not that familiar with the in's and out's of the online forum stuff...but I'm learning. :D

Thanks for the advice Helge!!

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...