Jump to content
Sign in to follow this  
neo2k

Newbie help regarding WinWaitActive

Recommended Posts

neo2k

Hi! New with AutoIt, and just starting to make my first simple scripts.. I was wondering about the winwaitactive command.

I'm using autoit to help me out with an installation that's running silent. At the end of the installation (a MSI) it shows a window prompting the user for a reboot. Don't really like this, so this is where the Autoit script should kick in. I'm using a commandline to install the application:

c:\windows\system32\msiexec.exe /i myapp.msi /qn

Do i need to start the WinWaitActive before running the commandline in Autoit..? What i had in mind:

WinWaitActive("Reboot required", [25])

Run ("C:\WINDOWS\system32\msiexec.exe /I MyApp.msi /QNS")

Send ("!n")

Or will AutoIt "hang" (for X time specified with winwaitactive) and just wait for the window to appear before running the next command? (the installation itself) So, are commands run one at a time or will it run the commands simultaniously..? Thanks in advance..! :lmao:

Share this post


Link to post
Share on other sites
Ed_Maximized

Hi! New with AutoIt, and just starting to make my first simple scripts.. I was wondering about the winwaitactive command.

I'm using autoit to help me out with an installation that's running silent. At the end of the installation (a MSI) it shows a window prompting the user for a reboot. Don't really like this, so this is where the Autoit script should kick in. I'm using a commandline to install the application:

c:\windows\system32\msiexec.exe /i myapp.msi /qn

Do i need to start the WinWaitActive before running the commandline in Autoit..? What i had in mind:

WinWaitActive("Reboot required", [25])

Run ("C:\WINDOWS\system32\msiexec.exe /I MyApp.msi /QNS")

Send ("!n")

Or will AutoIt "hang" (for X time specified with winwaitactive) and just wait for the window to appear before running the next command? (the installation itself) So, are commands run one at a time or will it run the commands simultaniously..? Thanks in advance..! :ph34r:

WinWaitActive waits for specific window to make active... You first have to RUN the install routine...

Run ("C:\WINDOWS\system32\msiexec.exe /I MyApp.msi /QNS")
WinWaitActive("Reboot required", [25])
Send ("!n")

Should work

Note that "Reboot required" must be the exact title of the window you are waiting for... :lmao:

Share this post


Link to post
Share on other sites
Skruge

Welcome to the forums! (Both of you)

WinWaitActive waits for specific window to make active...

A common misconception is that WinWaitActive activates a window.

In actuality, it waits for a window to become active by other means.

@neo- [25] isn't valid syntax... It appears you want to wait for 25 seconds. If so, use this:

Run (@SystemDir & "\msiexec.exe /I MyApp.msi /QNS")
WinWait("Reboot required", "", 25)
WinActivate("Reboot required")
Send ("!n")
Take a look at ControlSend and ControlClick to get around using Send in this case. These functions don't require the window to be active or even visible.

Also, it's best to specify the full path to your MSI.


[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites
AzKay

Wouldnt you be able to

Run(@SystemDir & "\msiexec.exe /I MyApp.msi /QNS", "", @SW_HIDE)
?

Edited by AzKay

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites
neo2k

I'm currently looking into the ControlSend fuction. What if the window doen't appear every time? Does the script pause then?

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.