Jump to content

Error in AutoIt Help?


Recommended Posts

Hello,

Look this: http://www.autoitscript.com/autoit3/docs/k...ds/ExitLoop.htm

The Help says that I can put the number of loop to exit.

But why doesn't this script work?

#include <GUIConstantsEx.au3>

GUICreate("My GUI") 
    GUISetState(@SW_SHOW) 


    While 1
        $msg = GUIGetMsg()
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop[2]
    WEnd

Error:

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\......\Desktop\PowerEr\exit.au3"    
C:\Users\......\Desktop\PowerEr\exit.au3 (9) : ==> Error in expression.:
If $msg = $GUI_EVENT_CLOSE Then ExitLoop[2]
If $msg = $GUI_EVENT_CLOSE Then ExitLoop ^ ERROR
>Exit code: 1   Time: 0.225

bye

Edited by FSoft
Link to comment
Share on other sites

Wrong syntax ... plus only one loop :P....

#include <GUIConstantsEx.au3>

GUICreate("My GUI")
GUISetState(@SW_SHOW)

While 1
    While 1
        $msg = GUIGetMsg()
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop 2
    WEnd
WEnd

The square brackets in the help-file indicate that the value is optional...

ExitLoop(2)

also works

Edited by KaFu
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...