mpenkov Posted November 5, 2010 Share Posted November 5, 2010 Hi, Is there a way to prevent autoit3.exe exiting until the script execution is complete? For example, given the following script: Sleep(10000) I run the script using the following command from the command line: autoit3.exe my_script.au3 And the autoit3.exe executable returns (finishes execution) immediately. Is there any way to make it block (not return) until the script execution is complete? Cheers, Michael Link to comment Share on other sites More sharing options...
Developers Jos Posted November 5, 2010 Developers Share Posted November 5, 2010 Hi, Is there a way to prevent autoit3.exe exiting until the script execution is complete? For example, given the following script: Sleep(10000) I run the script using the following command from the command line: autoit3.exe my_script.au3 And the autoit3.exe executable returns (finishes execution) immediately. Is there any way to make it block (not return) until the script execution is complete? Cheers, Michael no it won't until the script is finished unless it needs to restart itself for admin reasons. 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. Link to comment Share on other sites More sharing options...
mpenkov Posted November 6, 2010 Author Share Posted November 6, 2010 no it won't until the script is finished unless it needs to restart itself for admin reasons.Thank you for your reply. Unfortunately, I'm not quite sure I understand your answer completely. Are you saying that when you run the above script, the executable doesn't return until the 10 second sleep is finished? I am observing the opposite here -- instead of sleeping for the specified time, the executable returns immediately. What are the admin reasons you speak of? Is there a way to determine if this is what is happening?Looking forward to your clarification.Cheers,Michael Link to comment Share on other sites More sharing options...
Developers Jos Posted November 6, 2010 Developers Share Posted November 6, 2010 I am indeed saying that AutoIt3.exe will not terminate until after 10 seconds. just check your systemtray for the autoit3 icon that will appear for 10 seconds. The reason you will see the commandprompt return immediately is that AutoIt3 is a windows program. you see the same when you would run Notepad from the commandprompt. 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. Link to comment Share on other sites More sharing options...
mpenkov Posted November 6, 2010 Author Share Posted November 6, 2010 (edited) I am indeed saying that AutoIt3.exe will not terminate until after 10 seconds. just check your systemtray for the autoit3 icon that will appear for 10 seconds. The reason you will see the commandprompt return immediately is that AutoIt3 is a windows program. you see the same when you would run Notepad from the commandprompt. Ah, I see. Thank you. I've used Python to write an app that causes the current thread to sleep until the AutoIt3.exe process completes. It's a bit of a roundabout way of getting to where I needed to go, but it's good enough. In case anyone else tries to do this, here's the Python code: # # Need for this: # # win32 extensions: http://python.net/crew/skippy/win32/Downloads.html # WMI: http://timgolden.me.uk/python/wmi/tutorial.html # import wmi c = wmi.WMI() fname = P.basename('AutoIt3.exe') while len(c.Win32_Process(name=fname)) > 0: time.sleep(0.2) Edited November 6, 2010 by mpenkov Link to comment Share on other sites More sharing options...
Developers Jos Posted November 6, 2010 Developers Share Posted November 6, 2010 (edited) Just load the full version of SciTE4Autoit3 and compile the script with the following directive should also accomplish it: #AutoIt3Wrapper_Change2CUI=y After that shell the compiled script in stead of autoit3. Another option is to use the START /W command the shell autoit3 like: start /w autoit3 test.au3 Edited November 6, 2010 by 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. Link to comment Share on other sites More sharing options...
mpenkov Posted November 6, 2010 Author Share Posted November 6, 2010 Cool, thanks again! 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