Jump to content

Loop problems :(


Newbi3
 Share

Recommended Posts

Code:

#include <GuiConstantsEx.au3>

#include <IE.au3>

MainGui()

Func MainGui()

Local $Run, $Button_2, $msg

GUICreate("Short Cuts") ; will create a dialog box that when displayed is centered

Opt("GUICoordMode", 2)

$Run = GUICtrlCreateButton("Run Somthing", 0, 0, 100)

$Button_2 = GUICtrlCreateButton("Go to a website", 0, -1)

GUISetState() ; will display an dialog box with 2 button

; Run the GUI until the dialog is closed

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case $msg = $Run

$program = InputBox ("What program?", "Type program name and extestion here")

Run($program)

Case $msg = $Button_2

$program = InputBox ("Which website?", "Type website name here")

Dim $iMsgBoxAnswer

$iMsgBoxAnswer = MsgBox(36,"Ready?","Do you have Internet Explorer running?")

Select

Case $iMsgBoxAnswer = 6 ;Yes

Case $iMsgBoxAnswer = 7 ;No

WEnd

EndSelect

Run($program)

EndFunc

----------------------------------------------------------------------------------------------------------------------------

I made this program today to make it easier to do things. I am going to add MANY more things you can do :(. I can not run it though because it says there is no While for the WEnd or no WEnd for the While ??? :mellow:. I was wondering if any of you people can help me out. Thanks for ANY help in advance :lol:

P.S. There is a download if you prefer to download the code :P

AMP.au3

Link to comment
Share on other sites

Indentation (TAB use) has a very good purpose: to help with such cases (If/EndIf, Select/EndSelect, Switch/EndSwitch ...) USE IT and think a little before asking for help.

You had 1x EndSelect missing and WEnd position was wrong in relation to your EndSelect.

Use "autoit" tags to post your code.

Here is the fixed code:

Func MainGui()

    Local $Run, $Button_2, $msg
    GUICreate("Short Cuts") ; will create a dialog box that when displayed is centered
    Opt("GUICoordMode", 2)
    $Run = GUICtrlCreateButton("Run Somthing", 0, 0, 100)
    $Button_2 = GUICtrlCreateButton("Go to a website", 0, -1)

    GUISetState() ; will display an dialog box with 2 button

    ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            Case $msg = $Run
                $program = InputBox ("What program?", "Type program name and extestion here")
                Run($program)
            Case $msg = $Button_2
                $program = InputBox ("Which website?", "Type website name here")

                Dim $iMsgBoxAnswer
                $iMsgBoxAnswer = MsgBox(36,"Ready?","Do you have Internet Explorer running?")
                Select
                    Case $iMsgBoxAnswer = 6 ;Yes
                        Run($program)
                    Case $iMsgBoxAnswer = 7 ;No
                        
                EndSelect
        EndSelect
    WEnd
EndFunc
Edited by enaiman

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...