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

Share this post


Link to post
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

Share this post


Link to post
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 =" "

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
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.

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Jamestay97
      Hello! Thanks you for looking at my post
      **No source code I'm sorry work related can't copy information**
      I've been using autoit for about 1 year. 
      I'm having trouble automating a click on an internet explorer web page and I've tried a lot of examples from help pages and forums already. The object I'm trying to click on isnt always in the same spot so I can't use mouse click or control click, I have tried to use the different get collection options and clickbyname, or index or get object. I'm just struggling. 
      Description of object I'm trying to click -- 
      HTML Code looks like <a ng-click.. "Click Here" it appears it's just a click able object named "click here" that opens a hidden window by running a script inside the web page. I'm not able to grab the information from the window unless it's open so I have to automate this click somehow. 
       
      I understand it's difficult to assist without having something to look at, I apologize for that sincerely and appreciate and assistance and suggestions. 
    • By kingjacob90
      Hi
      So I am trying to click the green button, this button is not always in the same place. So fare I am trying to click it by finding the color but there is also something else with the same color on the screen (circled in yellow) that is causing issues. Is there a way to use the Title and Class of the window (can't be just the window as there are more than one with the same name).
      How does AutoIt Info get this information?

    • By adjist
      Hello all! 
       
      Getting this error :
      (22) : ==> Variable used without being declared.: if $vNumber = 0 Then if ^ ERROR  
      But I'm sure I have defined the variable, as in the top of my script has 
      Global $vNumber = 0  
      How would I go about fixing this?
       
    • By MarkIT
      Hi AutoIT masters,
      Good day! Sorry to have bothered this forum but we really need help. We are working on an automation project that is running on VDI server. The BOTS are in .exe are running fine until AV detected them and deleted the files. The files were re-compiled and AV kept on deleting them. The copy of the .exe BOT deleted were sent to Symantec for whitelisting. After whitelisting, it is no longer deleted but no longer working as designed (showing Line script error). We checked the scripts and there were no issues since we run it using SciTE editor and it performed the desired task. Good thing we found on this thread the solution using .a3x and the BOTS worked fine and no longer deleted. Now, the problem is they are asking why the BOTS won't run in .EXE and what is the reason behind Symantec AV deleting them. We raised a case with Symantec but they cannot provide further information as they are always seeing the file as "False Positive". We even tested with Symantec turned off and those .EXE files are working fine, however, after re-enabling, it got deleted.
      Just seeking help on how to better convince them that it is really Symantec causing the issue and the .a3x file.
    • By AutoitMike
      Scite 3.4.4
      Win 10
      I click "Help" or press F1, there is no response
      If I use the file explorer and double click Autoit.chm or Autoit3.chm help opens.
      There is no dialog to check or uncheck "Always ask before opening this file" when clicking on these files.
       
      If you are curious as to why I dont have the latest version, I am creating a back up laptop that has a VERY extensive automation application that I have written over the past 15 years.
       
      An extremely potent, powerful, needed function has been deleted in the upgrade of Autoit in recent years that I can not do without. If my main laptop dies, which it almost did, I am in a very bad position. So I bought the exact same laptop and I am "cofiguring" it to work exactly the same as my main laptop. However, this one has been "Upgraded" to Win 10 which I hope is not the problem. 
      Thanks for any help
×
×
  • Create New...