level20peon Posted May 20, 2009 Share Posted May 20, 2009 (edited) How would one implement something like test() Func test() if WinExists('windowXYZ')Then MsgBox(0,'','window exists') EndFunc EndIf MsgBox(0,'',"window doesn't exist") EndFunc It throw's an error "missing EndIf" if the windowXYZ exists. Edited May 20, 2009 by level20peon Link to comment Share on other sites More sharing options...
someone Posted May 20, 2009 Share Posted May 20, 2009 Just use Return instead of EndFunc in the if statement While ProcessExists('Andrews bad day.exe') BlockInput(1) SoundPlay('Music.wav') SoundSetWaveVolume('Louder') WEnd Link to comment Share on other sites More sharing options...
torels Posted May 20, 2009 Share Posted May 20, 2009 EndFunc acually tells the interpreter that the section dedicated to the punction's code is finished to exit a function you must use Return you can use return or return + a value $a=_func1() $b=_func2() msgbox(0,"",$B) msgbox(0,"",_func2()) ;they will return the same thing =) Func _func1() if 1=1 then msgbox(0,"","This will return nothing") return endif msgbox(0,"","This Code Won't Be Executed because of the return!") endfunc Func _func2() msgbox(0,"","This will return some text") return "some text" msgbox(0,"","This Code Won't Be Executed because of the return!") endfunc I hope I was clear Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org Link to comment Share on other sites More sharing options...
level20peon Posted May 20, 2009 Author Share Posted May 20, 2009 (edited) Great, thanks to both of you. Edited May 20, 2009 by level20peon Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now