fosil Posted December 6, 2016 Posted December 6, 2016 Hi all, I'm working on a relatively complex automation program and I need it to call a specific function when it is closed by a user. Ive resorted to "OnAutoItExitRegister" as i believe that's the only option available. This command works perfectly fine in a small scale test application I wrote, but once implemented in the final program that's much larger and divided over many files in many directories it no longer works. I don't get any error messages. My question is has anyone encountered an issue where implementation of this command in a large scale program gave them trouble? Does it matter where "OnAutoItExitRegister" is called and where the function is located? Currently they are both places in the main file that runs the whole program but it still doesn't work. Any help is appreciated
Moderators JLogan3o13 Posted December 6, 2016 Moderators Posted December 6, 2016 @fosil I will tell you that you are going to get minimal assistance without code; unless we can see what you're doing (or at least a reproducer that shows the issue), we're resorting to guessing. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
fosil Posted December 6, 2016 Author Posted December 6, 2016 2 minutes ago, JLogan3o13 said: @fosil I will tell you that you are going to get minimal assistance without code; unless we can see what you're doing (or at least a reproducer that shows the issue), we're resorting to guessing. I agree, if you need something specific I can copy that over here but the scale is so huge that I dont know which part would be beneficial As far as the actual function being called goes its like this : OnAutoItExitRegister("MyTestFunc") .... Func MyTestFunc() MsgBox($MB_SYSTEMMODAL, "Exit Results 1", 'Exit Message from MyTestFunc()') EndFunc ;==>MyTestFunc Where the OnAutoItExitRegister is being called directly after #include at the top of the code, and MyTestFunc is currently the last function in the same file.
Moderators JLogan3o13 Posted December 6, 2016 Moderators Posted December 6, 2016 Which works just fine. If the script is too large, you would need to create a reproducer. I realize it is sometimes daunting when dealing with very large scripts, but just offering; you cannot expect people to troubleshoot when they can't see the code. What you have written thus far works just fine; something else in your code is stomping on calling the function. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
fosil Posted December 6, 2016 Author Posted December 6, 2016 ok I will try to see if I can reproduce it on a smaller scale. But in the meanwhile I'm wondering if anyone had similar experiences in the past
Developers Jos Posted December 6, 2016 Developers Posted December 6, 2016 Is you script ending in a controlled manner as this really works as advertised: #include <MsgBoxConstants.au3> OnAutoItExitRegister("MyTestFunc") Sleep(5000) Func MyTestFunc() MsgBox($MB_SYSTEMMODAL, "Exit Results 1", 'Exit Message from MyTestFunc()') EndFunc ;==>MyTestFunc Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
nhanchiso Posted May 5, 2017 Posted May 5, 2017 Try move the func MyTestFunc to top ( as high as possible) of the file where you register OnAutoItExitRegister("MyTestFunc ")!
Developers Jos Posted May 5, 2017 Developers Posted May 5, 2017 1 hour ago, nhanchiso said: Try move the func MyTestFunc to top why? Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
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