Sign in to follow this  
Followers 0
Bokkie

Winwaitactive Does Not Detect My Window.

11 posts in this topic

#1 ·  Posted (edited)

I'm running an installation and it correctly launches with the Run command. The dialog I'm interested in waiting for is shown in the screenshot.

Here's the script I'm using.

func InstallOutsideIn()
    local $command = @ComSpec & " /c ""OutsideIn\setupwin32.exe"""
    msgbox(0, "", $command)
    Opt("RunErrorsFatal", 0)
    Run($command, "", @SW_HIDE)
    if @error = 1 then
        msgbox(0, "" ,"Run error code is -1. Failed to start the command.")
        return
    EndIf
    if WinWaitActive("Installer", "", 10) = 0 then
        msgbox(0, "", "WinWaitActive timeout waiting for the Window to appear.")
        return
    endif
    Send("!N")
endfunc

Even though the dialog is displayed well within the 10 seconds I allow for it, my script never detects is and gets to the timeout msgbox. Any idea what I'm doing wrong or not doing correctly?

Edit: Interestingly, if I change the literals in the script to use Notepad, then it works! (confused).

Edited by Peter Hamilton-Scott

Share this post


Link to post
Share on other sites



I'm running an installation and it correctly launches with the Run command. The dialog I'm interested in waiting for is shown in the screenshot.

Here's the script I'm using.

func InstallOutsideIn()
    local $command = @ComSpec & " /c ""OutsideIn\setupwin32.exe"""
    msgbox(0, "", $command)
    Opt("RunErrorsFatal", 0)
    Run($command, "", @SW_HIDE)
    if @error = 1 then
        msgbox(0, "" ,"Run error code is -1. Failed to start the command.")
        return
    EndIf
    if WinWaitActive("Installer", "", 10) = 0 then
        msgbox(0, "", "WinWaitActive timeout waiting for the Window to appear.")
        return
    endif
    Send("!N")
endfunc

Even though the dialog is displayed well within the 10 seconds I allow for it, my script never detects is and gets to the timeout msgbox. Any idea what I'm doing wrong or not doing correctly?

Edit: Interestingly, if I change the literals in the script to use Notepad, then it works! (confused).

Not sure if this going to solve the issue. But here is what I normally do -

$strFile = @HomeDrive & "\OutsideIn\setupwin32.exe"

Run(@ComSpec & " /c " & $strFile, "', @SW_HIDE)

Share this post


Link to post
Share on other sites

I'm running an installation and it correctly launches with the Run command. The dialog I'm interested in waiting for is shown in the screenshot.

Here's the script I'm using.

func InstallOutsideIn()
    local $command = @ComSpec & " /c ""OutsideIn\setupwin32.exe"""
    msgbox(0, "", $command)
    Opt("RunErrorsFatal", 0)
    Run($command, "", @SW_HIDE)
    if @error = 1 then
        msgbox(0, "" ,"Run error code is -1. Failed to start the command.")
        return
    EndIf
    if WinWaitActive("Installer", "", 10) = 0 then
        msgbox(0, "", "WinWaitActive timeout waiting for the Window to appear.")
        return
    endif
    Send("!N")
endfunc

Even though the dialog is displayed well within the 10 seconds I allow for it, my script never detects is and gets to the timeout msgbox. Any idea what I'm doing wrong or not doing correctly?

Edit: Interestingly, if I change the literals in the script to use Notepad, then it works! (confused).

couple of things to check:

- run au3info to check if the text is correct

- try adding Opt("WinSearchChildren", 1) at the top of the script


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

Share this post


Link to post
Share on other sites

Not sure if this going to solve the issue. But here is what I normally do -

$strFile = @HomeDrive & "\OutsideIn\setupwin32.exe"

Run(@ComSpec & " /c " & $strFile, "', @SW_HIDE)

Milkfish, I am launching the command exactly as you do except for minor differences in the pathname. As I say, the installer I am launching does start ok, it's just the window detection thats failing.

Share this post


Link to post
Share on other sites

Not sure if this going to solve the issue. But here is what I normally do -

$strFile = @HomeDrive & "\OutsideIn\setupwin32.exe"

Run(@ComSpec & " /c " & $strFile, "', @SW_HIDE)

Don't think this will do anything other than start a CMD window hidden which will shell the program... :)

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

Share this post


Link to post
Share on other sites

couple of things to check:

- run au3info to check if the text is correct

- try adding Opt("WinSearchChildren", 1) at the top of the script

Here is what I normally do -

Run (...)

; Wait for your window to come out

$strTitle = "Fist window title after run command"

$strText = "Any specific text in the window"

if not WinWait($strTitle, $strText, 10) then

; Do your error handling

endif

...

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Don't think this will do anything other than start a CMD window hidden which will shell the program... :)

JdeB,

Screenshot shows what AU3Info detected.

Are you saying that I should not be running the installation using @ComSpec?

Edit: I tried running the installation using this command format without @ComSpec:

local $command = "OutsideIn\setupwin32.exe"

The installation is stilll launched ok but still no window is detected.

Edit #2: I also tried this but no joy!

Opt("WinSearchChildren", 1)
Edited by Peter Hamilton-Scott

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

JdeB,

Screenshot shows what AU3Info detected.

Are you saying that I should not be running the installation using @ComSpec?

Edit: I tried running the installation using this command format without @ComSpec:

local $command = "OutsideIn\setupwin32.exe"

The installation is stilll launched ok but still no window is detected.

Edit #2: I also tried this but no joy!

Opt("WinSearchChildren", 1)

Don't think @comspec is needed but it shouldn't matter either way ... as long as it starts.

You could try adding this option a tthe start as well : Opt("WinTitleMatchMode",2)...

Au3Info should show if the window text is readable or not ... (cannot see it in the part you posted..)

Edited by JdeB

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

Share this post


Link to post
Share on other sites

Looks like your install package is InstallShield, why not use silent install?

http://www.installshield.com/search/gsearc...kb&area=helpnet

Joon,

You've hit something on the head. The package is an InstallShield executable but it's something that's built using the Universal Installer product instead of the vanilla-flavoured Windows Installer product. I can pass it the -is:silent option and it does indeed install. A conventional Windows installer (if you have the .msi) lets you configure the installation directory using say:

msiexec /i whatever.msi INSTALLDIR="C:\Temp\PutItHere"

As much as I know about Windows installers I've never used the Universal installer. As you seem to know something about it, do you know how to define the installation directory? Something like:

winsetup32.exe -silent INSTALLDIR="C:\Temp\PutItHere"

using whatever the Universal installer syntax is for the equivalent.

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

I logged a support call at work earlier today and I just logged into to check my email for a reply. As it was, the support team in the US did reply.

For the record, Universal installers (Java runtime based in my case, which possibly explains why I can never get the window ???) allow an options file to be used by the setup program and the support contact sent me a copy of his file.

I can now run the installation (1) silently, and (2) with a different installation directory and that works fine. I can abandon the window detection code and simply let it run using RunWait.

Result! Of a sort. :)

Edited by Peter Hamilton-Scott

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