Sign in to follow this  
Followers 0
forever0donotknowme

loop

8 posts in this topic

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

#4 ·  Posted (edited)

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

#5 ·  Posted (edited)

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

If $readInput is blank (= "") Then just do nothing.


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

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

thanks my sir for help

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  
Followers 0

  • Similar Content

    • WiorDi37
      By WiorDi37
      Hello, Everyone!
      I want when clicking the exit button the window will close. If content changes upon exit the program will automatically choose not save.
      Look forward to the help, thanks.
      #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <AutoItConstants.au3> $GUI = GUICreate("Form1", 220, 119, 192, 124, $WS_SYSMENU) GUISetFont(10, 400, 0, "Tahoma") GUICtrlCreateGroup("Chuẩn bị trình chiếu", 16, 16, 185, 65) $ok_Button = GUICtrlCreateButton("Ok", 32, 48, 75, 25) $exit_Button = GUICtrlCreateButton("Exit", 112, 48, 75, 25) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $ok_Button ShellExecute(@MyDocumentsDir&'\Dich-thuat\Short-Document.pdf', "", "", Default, @SW_MAXIMIZE) WinWaitActive("Data and Computer Communications (Eighth Edition) - Google Chrome") ShellExecute(@MyDocumentsDir&'\Dich-thuat\Document.rtf', "", "", Default, @SW_MAXIMIZE) WinWaitActive("Document.rtf [Compatibility Mode] - Word") ShellExecute(@MyDocumentsDir&'\Dich-thuat\Presentation1.pptx', "", "", Default, @SW_MAXIMIZE) WinWaitActive("Presentation1.pptx - PowerPoint") MouseClick("left", 1381, 886, 1) Sleep(2000) MsgBox(64, "Thông báo", "Đã chuẩn bị xong") Case $exit_Button WinClose("Presentation1.pptx - PowerPoint") ;I need help handling this place Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd  

    • badcoder123
      By badcoder123
      Hey everyone,
      I've been messing around with some new things and adlibs look extremely useful/interesting, however, I can't seem to get it to work.. Here's what I have
      HotKeySet("{F1}", "_Exit") $qCount = 1 Global $_Timer AdlibRegister($_Timer, 1000) AdlibUnRegister($_Timer) While 1 SoundPlay(@WindowsDir & "\media\tada.wav", 1) $qCount += 1 ToolTip('"Tada" has been played ' & $qCount & " times",200,200) WEnd Func _Timer() Local Static $iCount += 1 ConsoleWrite($iCount) If $iCount = 20 Then ConsoleWrite("iCount is at " & $iCount) EndFunc Func _Exit() Exit EndFunc Basically I want it to call the _Timer function but it doesn't seem to work :/ any ideas?
    • DagSa
      By DagSa
      Try to find a solution for help files to my autoit executable.
      Its installed from simple XP-POS cash computers to desktop with windows 7, 8, 10.
      The compiled AutoIt program itself work everywhere, but the help file??
      I need a help file called from from the program and I don't really know what working best in all OS platforms.
      1. A wordfile is helpful enough, but word is not installed everywhere.
      2. RTF is very big files with pictures.
      3. I could save it as pdf, but not all have it either.
      4. Tried  .MHT file, but downside is browser could cover hole screen if browser closed this way. I have not found any way to resize it to specific size when open up.
      5. Use of IE.au3 lib. Well it could open mht files ,but always got question about use it as default browser or not. Think this also make IE browser lose control so I could not resize.
      6. Look at making a  .CHM file, but I don't think its the future do use that format. (.hlp is no no and old)

      Any tips of do it in autoit or make a call to open up in some nice format working everywhere.
       
    • au3leecher
      By au3leecher
      Hellow everybody,
      I tryed to manipulate a game called "Assault Cube" which is a easy beginning in coding. I run the code but the wished value doesn't change, i don't understand why.
      The Pointers are fine, I checked that the pointers don't change every time while restart the game.
      My Code:
      <snip>
      _____________________________________________________________________________________________________________________________________________________________________________________________
      Checklist:
      The Offsets are 18C & 4
      In Cheat Engine: ("ac_client.exe"+0010F418) <- Pointer
      4 Bytes = 'dword'
       
    • geekyworld
      By geekyworld
      Hi. I want to read the help file on my Kindle ebook reader (to protect my eyes). Is it available in Kindle or epub format? I tried converting it myself but the results were not very good.
      --Thanks!