Jump to content

How to force end or exit a function?


Recommended Posts

I've found if a function is still running I can not close (Exit) the GUI.

I have a condition within the function that when meet I'd like to exit or end the function so the user can then close the GUI if they wish, but I can't find the syntax for exiting the function...

I thought it might just be EndFunc but if I put that within my If/EndIf condition statment I get an error about having no EndIf

Func AutoHost()
;Do First map load error check else move on
    $x = 0
    If WinExists("Program Error") Then

       ;stuff to deal with errors here 
        Sleep(1000)
        EndFunc

    EndIf

;Other function stuff here if no load errors

EndFunc

I've checked the AutoIt help and searched these forums, but I'm bugged if I can find it...

My AutoIt Scripts.- AutoHost and Password Enabler for Delta Force 2 Demo.| Caffine for Winamp 2.9x and WRS 2.0 | mp3 directory cleaner | CRAP DJ | A:B:J Radio Automation Software | FFMPEG batch conversion automator

Link to comment
Share on other sites

I've found if a function is still running I can not close (Exit) the GUI.

I have a condition within the function that when meet I'd like to exit or end the function so the user can then close the GUI if they wish, but I can't find the syntax for exiting the function...

I thought it might just be EndFunc but if I put that within my If/EndIf condition statment I get an error about having no EndIf

Func AutoHost()
;Do First map load error check else move on
    $x = 0
    If WinExists("Program Error") Then

      ;stuff to deal with errors here 
        Sleep(1000)
        EndFunc

    EndIf

;Other function stuff here if no load errors

EndFunc

I've checked the AutoIt help and searched these forums, but I'm bugged if I can find it...

Maybe

Func AutoHost()
;Do First map load error check else move on
    $x = 0
    If WinExists("Program Error") Then
           Return; *********** returns control to GUI ( user can exit )
           Exit; ************* closes the scipt completely no user input
      ;stuff to deal with errors here 
        Sleep(1000)
        EndFunc

    EndIf

;Other function stuff here if no load errors

EndFunc

8)

NEWHeader1.png

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...