Jump to content

Recommended Posts

Posted (edited)

Is there a way to loop back to the beginning and keep the already entered data in the GUI Input boxes? I can GUIDelete and start a new GUI but all the typed data has to be redone. Here is a sample.


 

#Include <GuiConstants.au3>

Dim $msg,$okbutton,$cancelbutton,$objOU,$intAccValue,$strGroup1,$strGroup2
Dim $strFirstName,$strLastName,$strUserName,$strUserName2,$strPassword,$strDescription,$strContainer
Dim $Combo,$Duration


Do

$Form1 = GuiCreate("", 300, 300)
         GUISetBkColor(0xA6CAF0)

        GuiCtrlCreateLabel("First Name:", 50, 10)
        $strFirstName = GuiCtrlCreateInput("", 50, 25, 200, 20)

        GUICtrlSetState ( $okbutton, $GUI_FOCUS )
        GuiSetState()

    $okbutton = GUICtrlCreateButton ("OK",75,240,50,20)
    $cancelbutton = GUICtrlCreateButton ("Cancel",175,240,50,20)

While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE Or $msg = $cancelbutton
            Exit
    Case $msg = $okbutton
            $strFirstName = GUICtrlRead($strFirstName)
            ExitLoop
    EndSelect
Wend


$len = StringLen($strFirstName)

    If $len > "20" then
        MsgBox(0, "ERROR Name to long", $strFirstName & " can't be over 20 characters." & @CRLF & "Total: " & $len)
        ;Exit
        GUIDelete($Form1)
    EndIf

Until $len < "20"

MsgBox(0, "Done", "")

 

Edited by Jos
added codebox
Posted

REad the input to a variable..

  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

Posted
#Include <GuiConstants.au3>

Dim $msg,$okbutton,$cancelbutton,$objOU,$intAccValue,$strGroup1,$strGroup2
Dim $strFirstName,$strLastName,$strUserName,$strUserName2,$strPassword,$strDescription,$strContainer
Dim $Combo,$Duration



  $Form1 = GuiCreate("", 300, 300)
         GUISetBkColor(0xA6CAF0)

        GuiCtrlCreateLabel("First Name:", 50, 10)
        $strFirstName = GuiCtrlCreateInput("", 50, 25, 200, 20)

    $okbutton = GUICtrlCreateButton ("OK",75,240,50,20)
    $cancelbutton = GUICtrlCreateButton ("Cancel",175,240,50,20)

        GUICtrlSetState ( $okbutton, $GUI_FOCUS )
        GuiSetState()


While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE Or $msg = $cancelbutton
            Exit
    Case $msg = $okbutton
            $strFirstName = GUICtrlRead($strFirstName)
         $len = StringLen($strFirstName)

        If $len < "20" then ExitLoop
        MsgBox(0, "ERROR Name to long", $strFirstName & " can't be over 20 characters." & @CRLF & "Total: " & $len)
    EndSelect
Wend


MsgBox(0, "Done", "")

 

Posted

There, the OP doesn't even have to try.

  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

  • Moderators
Posted
  On 11/10/2018 at 1:49 AM, Nine said:

ya and ty

"REad the input to a variable.."

was sooo helpful !

Expand  

Since this forum operates on the "Teach a Man to Fish" motto rather than simply barfing up code without any explanation for a new coder, neither was terribly helpful. Rather than responding to every last jibe, how about focusing on helping people improve their coding abilities rather than spoon-feeding them, as I assume that is why you're here.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Posted

You're correct, sadly i had my child on my lap, she was messing with the keyboard and that was the only thing i could write at the moment.

I wanted to add more to my answer, but when i came back to edit there was no longer need for it.

  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

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
×
×
  • Create New...