rbhkamal Posted May 2, 2006 Share Posted May 2, 2006 (edited) In a situations where your script use a function_1 that calls another function_2 and function_2 calls function_3 and function_3 calls function_n thenA COM error just occurred (or OnEvent mode was used) and you want to exit all the way back to the GUI loop immediately without executing any more lines beyond that error.I tried to put the line (if $RETURN = True then Return) all over my functions and I got (136 extra lines!!! ).Edit: When ESC pressed I set $RETURN = True ( with onEvent mode turned on)Is there any way that AutoIt developers team can include a command that returns all the currently used Functions until the desired function is found.Example:Function_1 calls Function_2 Function_2 calls Function_3 Function_3 has Return (Function_1, 202) ;Now back to Function_1 immediatelyDescription:Function_1 : Is the function that the Return() command will stop executing at.202: Will be the return value for all the function.I think this is a great addition to Autoit_beta.NOTE: I was using OnEvent mode (to Cancel a Loop inside a function that calls other functions.)Let me know if you have any questions. Edited May 2, 2006 by rbhkamal "When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix Link to comment Share on other sites More sharing options...
Valik Posted May 2, 2006 Share Posted May 2, 2006 This sounds like two things to me:Poorly structured code.A poor-man's goto. Link to comment Share on other sites More sharing options...
rbhkamal Posted May 2, 2006 Author Share Posted May 2, 2006 (edited) This sounds like two things to me:Poorly structured code.A poor-man's goto.They have that command where I work.It was just an Idea Edited May 2, 2006 by rbhkamal "When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix Link to comment Share on other sites More sharing options...
rbhkamal Posted May 2, 2006 Author Share Posted May 2, 2006 (edited) It was just an Idea And when some one think about a script ..... it shouldn't be too big.I already manged to do what I want.As I said it's just an IDEA Edited May 2, 2006 by rbhkamal "When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix Link to comment Share on other sites More sharing options...
Uten Posted May 3, 2006 Share Posted May 3, 2006 I have thought about it for a few minutes... and it is my impression that this will not be explored. There are too many caveats. My secondary impression is that you need to revisit the flow of your code. There are many alternatives when writing concise scripts.136 lines is not that much... Error handling is usually (for me) 40 - 60% of code.Lar.I wrote something along the same lines as @Larry but never got around to post it. Proper error handling is time consuming and makes your code look ugly if you want to cover all bases.They have that command where I work.It was just an Idea In what kind of environment/language is that? It would be interesting to see a quick code sample, if you could provide it.A throw catch mechanism can be implemented but will probably increase the size of the script engine a lot.Anyone interested in the topic should take a look at chapter 13 exceptions in Object-orineted programming with ANSI-C by Axel-Tobias Schreiner. It's a heavy read (or should I say study ). Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
rbhkamal Posted May 3, 2006 Author Share Posted May 3, 2006 (edited) In what kind of environment/language is that? It would be interesting to see a quick code sample, if you could provide it.I'm sorry I can't provide that and the reason is that it's used for a filtering Engine on a BorderGuard.So it could not be used for regular hardware.This is kind of a new product. feel free to check it out at www.blueridgenetworks.com Edited May 3, 2006 by rbhkamal "When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix Link to comment Share on other sites More sharing options...
Uten Posted May 4, 2006 Share Posted May 4, 2006 They have that command where I work.It was just an Idea I'm sorry I can't provide that and the reason is that it's used for a filtering Engine on a BorderGuard.So it could not be used for regular hardware.This is kind of a new product. feel free to check it out at www.blueridgenetworks.comOK, I probably misinterpeded "They have that command where I work", thought it ment that you could use a command (as in programing language command) to jump back in your callstack upon an error. If it was more like "They want me to implement this" then you should realy take a look at the pdf link I gave. Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
Nutster Posted May 4, 2006 Share Posted May 4, 2006 (edited) I am having problems using the link you gave, but found this one instead. It has a link to the PDF file and contains some other useful information. Edited May 4, 2006 by Nutster David NuttallNuttall Computer Consulting An Aquarius born during the Age of Aquarius AutoIt allows me to re-invent the wheel so much faster. I'm off to write a wizard, a wonderful wizard of odd... Link to comment Share on other sites More sharing options...
rbhkamal Posted May 4, 2006 Author Share Posted May 4, 2006 (edited) OK, I probably misinterpeded "They have that command where I work", thought it ment that you could use a command (as in programing language command) to jump back in your callstack upon an error. If it was more like "They want me to implement this" then you should realy take a look at the pdf link I gave.Thank god. NO they don't want me to. it's already done.Edit: Thanks for the DPF Edited May 4, 2006 by rbhkamal "When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix Link to comment Share on other sites More sharing options...
Uten Posted May 4, 2006 Share Posted May 4, 2006 I am having problems using the link you gave, but found this one instead. It has a link to the PDF file and contains some other useful information.Thanks for looking it up. Sorry you encountered problems with the link I provided. I used google to find it and downloaded the document from there so i don't know what went wrong.Your right the other books provided there is absolutely worth a read. I studied Thinking in C++ some years ago and learned a lot Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
rbhkamal Posted May 4, 2006 Author Share Posted May 4, 2006 There should be NO reason to buy or borrow books for programming:http://www.techtoolblog.com/archives/195-f...ogramming-books "When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix Link to comment Share on other sites More sharing options...
Valik Posted May 4, 2006 Share Posted May 4, 2006 There should be NO reason to buy or borrow books for programming:http://www.techtoolblog.com/archives/195-f...ogramming-booksI disagree. Anybody serious about C++ should own a copy of "The C++ Programming Language" by Bjarne Stroustrup. That books is most certainly not free. There are other "must-have" books for other languages that aren't going to be free, too. Stroustrup's book is worth it's price simply for having as reference material. Link to comment Share on other sites More sharing options...
Uten Posted May 4, 2006 Share Posted May 4, 2006 I disagree. Anybody serious about C++ should own a copy of "The C++ Programming Language" by Bjarne Stroustrup. That books is most certainly not free. There are other "must-have" books for other languages that aren't going to be free, too. Stroustrup's book is worth it's price simply for having as reference material.Agree with you @Valik. Except that Strostrups book is totally "unreadable" . But it is definitely the authorative guid. (hmm, dont know how to spell authorative, so I hope you all understand.) Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
Valik Posted May 4, 2006 Share Posted May 4, 2006 Agree with you @Valik. Except that Strostrups book is totally "unreadable" . But it is definitely the authorative guid. (hmm, dont know how to spell authorative, so I hope you all understand.)I managed to learn C++ from Stroustrup without any prior programming experience so to say it is unreadable is a bit harsh. I wouldn't recommend to anybody else to attempt the same thing as it is a very difficult book to follow at times, however it is definitely readable.The word you're trying to spell is authoritative. 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