Jump to content
Sign in to follow this  
Chubs

Need HELP with verifying missing data

Recommended Posts

Chubs

I need some help figuring this out please.

I am writing a script to run on info provided in a GUI all fields need to be filled out for the script to work. I am trying to write in code to prompt with a list of missing info if left blank when you click the start button. I don't really want to use ini files. I can do this all day for just one variable but am having problems checking for multiple variables/inputs. Tried fooling around with "For" statement but either I am over thinking it or I am going about it all wrong. Can anyone help out with this please?

guiverifydata - Copy.au3

*******code********

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Global $button, $msg, $TECHID, $USERID, $DATAP

Dim $aArray[3]

GUICreate("gui_test", 200, 200)

GUISetState()

Global $TLable = GUICtrlCreateLabel("Tech ID", 30, 15)

Global $TID = GUICtrlCreateInput("", 30, 30, 75, 20)

GUICtrlSetState(-1, $GUI_FOCUS)

Global $ULable = GUICtrlCreateLabel("User ID", 30, 65)

Global $UID = GUICtrlCreateInput("", 30, 80, 75, 20)

Global $DLable = GUICtrlCreateLabel("Datapath", 30, 115)

Global $DID = GUICtrlCreateInput("", 30, 130, 75, 20)

$button = GUICtrlCreateButton("start", 85, 170)

While 1

$msg = GUIGetMsg()

If $msg = $GUI_EVENT_CLOSE Then ExitLoop

If $msg = $button Then

$TECHID = GUICtrlRead($TID)

$USERID = GUICtrlRead($UID)

$DATAP = GUICtrlRead($DID)

;if data input is blank open gui or msgbox stating the fields that are missing - after close continueloop

$aArray[0] = $TECHID

$aArray[1] = $USERID

$aArray[2] = $DATAP

Global $string = ""

For $element In $aArray

If $aArray = "" Then

Select

Case $aArray = $TECHID

$string = "Tech ID"

Case $aArray = $USERID

$string = "User ID"

Case $aArray = $DATAP

$string = "User Datapath"

EndSelect

EndIf

$string = $string & $element & @CRLF & "________________" & @CRLF

Next

MsgBox(4096, "Missing Info", $string)

ExitLoop

EndIf

WEnd

GUIDelete()

Share this post


Link to post
Share on other sites
mini
Chubs

I am looking for the tech to enter in his name, cu's id# and user datapath on server to be used later in the script and for logging purposes. If tech clicks start before entering all needed info, have script prompt the fields that were missed the go back to gui to be corrected....the script listed above is to show general idea method. There is alot of other fields on the gui but did not post them to keep the idea simple for the forums.

Share this post


Link to post
Share on other sites
GEOSoft

#Include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Global $button, $msg, $TECHID, $USERID, $DATAP
Dim $aArray[3]

GUICreate("gui_test", 200, 200)
GUISetState()

Global $TLable = GUICtrlCreateLabel("Tech ID", 30, 15)
Global $TID = GUICtrlCreateInput("", 30, 30, 75, 20)
GUICtrlSetState(-1, $GUI_FOCUS)

Global $ULable = GUICtrlCreateLabel("User ID", 30, 65)
Global $UID = GUICtrlCreateInput("", 30, 80, 75, 20)

Global $DLable = GUICtrlCreateLabel("Datapath", 30, 115)
Global $DID = GUICtrlCreateInput("", 30, 130, 75, 20)

$button = GUICtrlCreateButton("start", 85, 170)


While 1
    $msg = GUIGetMsg()
    ;$sError = ""
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    If $msg = $button Then
        $TECHID = GUICtrlRead($TID)
        $USERID = GUICtrlRead($UID)
        $DATAP = GUICtrlRead($DID)
#cs
        ;if data input is blank open gui or msgbox stating the fields that are missing - after close continueloop
        $aArray[0] = $TECHID
        $aArray[1] = $USERID
        $aArray[2] = $DATAP
#ce
        Global $string = ""

        FOR $i = $TID To $DID

            If GUICtrlRead($i) = "" Then
                Switch $i
                    Case $TID
                        $string &= "Tech ID" & @CRLF
                    Case $UID
                        $string &= "User ID" & @CRLF
                    Case $DID
                        $string &= "User Datapath" & @CRLF
                EndSwitch
            EndIf

        Next
        If $string Then
            MsgBox(4096, "Missing Info", $string & "________________")
            ContinueLoop
        EndIf
        ExitLoop
    EndIf
WEnd


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites
Chubs

Thankyou so much...looks like I was on the right track but wrong direction....lol

Everything works great now...I really appreciate this...you rock

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  

×