Jump to content

Recommended Posts

hi my friends,

I do script but I can not get code that return me to main form

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("main form", 442, 169, 192, 124)
$Input1 = GUICtrlCreateInput("", 112, 56, 201, 21)
$Label1 = GUICtrlCreateLabel("type any thing in following box for display in message", 24, 24, 387, 28)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$Button1 = GUICtrlCreateButton("display", 272, 96, 131, 33)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Button2 = GUICtrlCreateButton("Exit", 80, 96, 107, 33)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
  case $Button1
   if $Input1 <>"" Then
    MsgBox(0,"", GUICtrlRead($input1))
   Else
    MsgBox(0,""," you do not enter any thing in box therefor you will return to main form")
    ;what is script that return to main form
   EndIf
   case $Button2
    Exit
EndSwitch
WEnd

What is script that return to main form if $input =0

Link to comment
Share on other sites

first you read the input, then you can check if is something in it

case $Button1
$readInput = GUICtrlRead($input1)
if $readInput <> "" Then
MsgBox(0,"", $readInput)
Else
MsgBox(0,"","you do not enter any thing in box therefor you will return to main form")
;what is script that return to main form
EndIf

....

Heroes, there is no such thing

One day I'll discover what IE.au3 has of special for so many users using it.
C'mon there'sĀ InetReadĀ and WinHTTP, way better
happy.png

Link to comment
Share on other sites

case $Button1
    $readInput = GUICtrlRead($input1)
    if $readInput ="" Then
     Exit
    ; do not work any thing
    ;what is script that return to main form
   Else
    MsgBox(0,""," you do not enter any thing in box therefor you will return to main form")
MsgBox(0,"", $readInput)

   EndIf

i want to return to main form if input =" "

Link to comment
Share on other sites

return? like without showing up a msgbox? if so just remove this part

Else
MsgBox(0,""," you do not enter any thing in box therefor you will return to main form")
;what is script that return to main form

btw, you can check help file for any command/function by pressing F1 (the command/func. needs to be clicked before hit F1)

Edited by DiOgO

Heroes, there is no such thing

One day I'll discover what IE.au3 has of special for so many users using it.
C'mon there'sĀ InetReadĀ and WinHTTP, way better
happy.png

Link to comment
Share on other sites

case $Button1
$readInput = GUICtrlRead($input1)
if $readInput ="" Then
     Exit
; do not work any thing
;what is script that return to main form
Else
MsgBox(0,""," you do not enter any thing in box therefor you will return to main form")
MsgBox(0,"", $readInput)

EndIf

i want to return to main form if input =" "

Try this instead. Do not use EXIT. that will terminate the script instead of returning you to the form and continuing the loop.

case $Button1
$readInput = GUICtrlRead($input1)
if $readInput ="" Then
MsgBox(0,""," you do not enter any thing in box therefor you will return to main form")
ContinueLoop
; return to main form
Else
MsgBox(0,"", $readInput)

EndIf
Edited by EndFunc
EndFuncAutoIt is the shiznit. I love it.
Link to comment
Share on other sites

Try this instead. Do not use EXIT. that will terminate the script instead of returning you to the form and continuing the loop.

case $Button1
$readInput = GUICtrlRead($input1)
if $readInput ="" Then
MsgBox(0,""," you do not enter any thing in box therefor you will return to main form")
ContinueLoop
; return to main form
Else
MsgBox(0,"", $readInput)

EndIf

thanks my sir

really you help me.

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

×
×
  • Create New...