Jump to content

Stop loop problem


Recommended Posts

I have message box inside an "If" statement where I have a "yes" or "no" question. Upon "no" the function is suppose to stop...but the GUI should remain open. If I put "exit" --- which is the only way I know how to stop a function --- the GUI exits. If I put in "EndLoop", it wont allow it. How do I do this?

Edit:

I solved the problem a different way, but am still interested in a specific solution for this if there is one.

Edited by Champak
Link to comment
Share on other sites

example :

Func _check_msgbox_overwrite($file,$dest,$type)
    if msgbox(1+256+48,"The destination is newer","Do you want to replace the newer file :" _
       &@lf&@lf&_gettime($dest&$type&$fname)&" "&$dest&$type&$fname&" "&@lf&@lf& _
       "by this older file ?"&@lf&@lf&_gettime($file)&" "&$file) = 1 then
        return 1
    Else
        return 0
    EndIf
EndFunc;==>_check_msgbox_overwrite
Edited by Gyzmok
D2charkeeper = No more 'expired characters' in D2.File Date Changer = Change the file date(s), attributes and the filename case of multiple files @ once.Updater_full = Copy/Update your autoitscripts, pictures, .mp3, .avi etc ... subdirs from your PC to your memory stick or to your external harddisk. Now with scheduling and logging.Questmapper
Link to comment
Share on other sites

Gyzmok is returning a boolean condition with the example. 0 is a false condition, and not 0 is true. Same concept can be regarded with strings as "" is a false condition, and "something" is a true condition. The keywords If and Then will test the condition. If you expect a string return, then the latter could be chosen as a suitable return value to use.

This may help with some understanding:

_Check( _0() )
_Check( _1() )
_Check( _2() )
_Check( _3() )

Func _Check($condition)
    ; Check the $condition
    If $condition Then
        MsgBox(0, $condition, 'True condition')
    Else
        MsgBox(0, $condition, 'False condition')
    EndIf
EndFunc

Func _0()
    ; Return a false numerical condition
    Return 0
EndFunc

Func _1()
    ; Return a true numerical condition
    Return 1
EndFunc

Func _2()
    ; Return a false string condition
    Return ""
EndFunc

Func _3()
    ; Return a true string condition
    Return "string"
EndFunc
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...