EndFunc Posted April 9, 2007 Share Posted April 9, 2007 I know you can set hot keys for certain things but I can seem to find out how can you break the currently running function without exiting the script? So if you have a function copying files and want to stop it how can you do that? I know in batch you can hit control c, but not sure how to set it in autoit with the hot key. thanks EndFuncAutoIt is the shiznit. I love it. Link to comment Share on other sites More sharing options...
magician13134 Posted April 9, 2007 Share Posted April 9, 2007 Return? Visit Magic Soft Inc. for some of my software Link to comment Share on other sites More sharing options...
lod3n Posted April 9, 2007 Share Posted April 9, 2007 (edited) Insert this at the top of your script:HotKeySet("^c", "Break") Func Break() Exit EndFunc Edited April 9, 2007 by lod3n [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
EndFunc Posted April 9, 2007 Author Share Posted April 9, 2007 Return?I think that's what I might be looking for. Thanks, I will have to figure out how to use it though. I have not used it in any of my funtions yet. EndFuncAutoIt is the shiznit. I love it. Link to comment Share on other sites More sharing options...
EndFunc Posted April 9, 2007 Author Share Posted April 9, 2007 Insert this at the top of your script:HotKeySet("^c", "Break") Func Break() Exit EndFunc Will this stop whatever it's doing? I have a GUI and want it to go back to a ready to input state if I am running a function. EndFuncAutoIt is the shiznit. I love it. Link to comment Share on other sites More sharing options...
lod3n Posted April 9, 2007 Share Posted April 9, 2007 (edited) No, it will quit the whole script. Doing what you are describing is somewhat more difficult. You need to set a global variable and check for it while your function runs.global $breaker = false HotKeySet("^c", "Break") Func Break() $breaker = true EndFunc ;and then in your function: Func MyFunc() while 1 ; blah ; blah ; blah ; blah if $breaker = true then $breaker = false return endif wend endfunc Edited April 9, 2007 by lod3n [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
EndFunc Posted April 9, 2007 Author Share Posted April 9, 2007 No, it will quit the whole script. Doing what you are describing is somewhat more difficult. You need to set a global variable and check for it while your function runs.global $breaker = false HotKeySet("^c", "Break") Func Break() $breaker = true EndFunc ;and then in your function: Func MyFunc() while 1 ; blah ; blah ; blah ; blah if $breaker = true then $breaker = false return endif wend endfuncI will give that a shot and see what I come up with. Thanks EndFuncAutoIt is the shiznit. I love it. Link to comment Share on other sites More sharing options...
magician13134 Posted April 15, 2007 Share Posted April 15, 2007 Return just bumps you out of a function, and (if told to do so) will store that value. IE: $var = func(4) Func func($i) $i = $i + 1 return $i EndFuncoÝ÷ Ûtß«Ú¯g£ª¹©lå8^±©r^Â+ajÉbf¡ØÆÚºÚ"µÍÌÍÝH[Ê B[È[Ê ÌÍÚJB ÌÍÚHH ÌÍÚH ÈB] ÌÎNÐR ÌÌÎÉÌÎNÂ[[ '$var' now equals 'BLAH!'. Play around with it... Visit Magic Soft Inc. for some of my software 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