Sign in to follow this  
Followers 0
mpenkov

autoit3.exe: don't exit until script execution is complete

7 posts in this topic

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

Share this post


Link to post
Share on other sites



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.

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#5 ·  Posted (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 by mpenkov

Share this post


Link to post
Share on other sites

#6 ·  Posted (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 by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Cool, thanks again!

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0