Jump to content
Sign in to follow this  
cyanidemonkey

How to force end or exit a function?

Recommended Posts

cyanidemonkey

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

Share this post


Link to post
Share on other sites
Valuater

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

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  

×