Jump to content

Window isn't active?


Recommended Posts

I'm new to this (obviously). I've been successful in creating a few scripts to install some programs but I'm stuck on Office 2003. This question may have been asked before, but I'm really not sure what the terminoligy is to search for and I haven't found anything by browsing. Forgive me if I'm being redundant.

Everything works fine through the first few windows. When I get to the 7th input window ("Setup is ready to begin installing..."), there's a lot of hard drive activity (relevant?) and my script stops as if it doesn't "see" that window. I haven't built beyond that, so the last thing it should do is to send an Enter and exit. It never exits and the installer never progresses. I've tried sending Enter, !I, and even ControlClick on the Install button. Nothing. If I manually click the button (or press Enter or Alt-I), the installer proceeds as it should so the window must be active. I've tried Sleep for a few seconds to give the window time to become active in case that's a problem. No difference.

Could there be something special about this window? Here's my entire script. ($PK is the Product Key.)

$PK="XXXXXXXXXXXXXXXXXXXXXXXXX"
Run("D:\APPLICATION CDS\Microsoft Office 2003 Professional\Office 2003 Disk 1\SETUP.EXE","D:\APPLICATION CDS\Microsoft Office 2003 Professional\Office 2003 Disk 1")
WinWaitActive("Microsoft Office 2003 Setup", "Product Key")
Send($PK)
Send("{ENTER}")
WinWaitActive("Microsoft Office 2003 Setup", "User Information")
Send("{DELETE}")
Send("{ENTER}")
WinWaitActive("Microsoft Office 2003 Setup", "End-User License Agreement")
Send(" ")
Send("{ENTER}")
WinWaitActive("Microsoft Office 2003 Setup", "Type of Installation")
Send("{DOWN 3}")
Send("{ENTER}")
WinWaitActive("Microsoft Office 2003 Setup", "Custom Setup")
Send("{TAB 3}")
Send("{SPACE}")
Send("{TAB}")
Send("{SPACE}")
Send("{ENTER}")
WinWaitActive("Microsoft Office 2003 Setup", "Advanced Customization")
Send("{ENTER}")
WinWaitActive("Microsoft Office 2003 Setup", "Setup is ready to begin installing")
ControlClick("Microsoft Office 2003 Setup", "Setup is ready to begin installing",5086)
Exit

There are probably better ways to do some of that, but this is only my third script.

BTW, I'm installing this on VPC 2007 to test it. VPC hasn't been a problem so far.

Any ideas?

Thanks.

Ray

Link to comment
Share on other sites

Try:

Run("D:\APPLICATION CDS\Microsoft Office 2003 Professional\Office 2003 Disk 1\SETUP.EXE","D:\APPLICATION CDS\Microsoft Office 2003 Professional\Office 2003 Disk 1")
WinWait("Microsoft Office 2003 Setup", "Product Key")
WinActivate("Microsoft Office 2003 Setup", "Product Key")
WinWaitActive("Microsoft Office 2003 Setup", "Product Key")
...
Link to comment
Share on other sites

@Zedna, Thank you for responding.

I tried the first suggestion (wait, activate, waitactive) but it didn't help. I only tried it on the last window since the rest work as is.

Then I tried changing the last line to:

ControlClick("Microsoft Office 2003 Setup", "Setup is ready to begin installing","[CLASS:Button; INSTANCE:1]")

(I think that's the right syntax) Again, no help. I didn't have a lot of confidence in that one because I think the problem is with AutoIt not detecting the window. Otherwise, even if I was sending bad data to the window, the script should execute that line then exit. I don't think it's getting that far.

I'll have to investigate the Opt('TrayIconDebug',1) recommendation. That sounds like it might lead to something, but I'm not sure how to use it yet. I'll let you know how that works.

Ray

Link to comment
Share on other sites

Perhaps this may help though the idea of using a MST file maybe easier with silent installation.

; Turn on custon debug window
$debug = True

; Product key
$PK="XXXXXXXXXXXXXXXXXXXXXXXXX"

; Run the installer
$path = 'D:\APPLICATION CDS\Microsoft Office 2003 Professional\Office 2003 Disk 1'
$ProcessID = Run('"' & $path & '\SETUP.EXE"', $path)

; Common window title
$title = "Microsoft Office 2003 Setup"

; Process the installation
_WinWaitActive($title, "Product Key")
Send($PK & "{ENTER}")
_WinWaitActive($title, "User Information")
Send("{DELETE}{ENTER}")
_WinWaitActive($title, "End-User License Agreement")
Send(" {ENTER}")
_WinWaitActive($title, "Type of Installation")
Send("{DOWN 3}{ENTER}")
_WinWaitActive($title, "Custom Setup")
Send("{TAB 3}{SPACE}{TAB}{SPACE}{ENTER}")
_WinWaitActive($title, "Advanced Customization")
Send("{ENTER}")
_WinWaitActive($title, "Setup is ready to begin installing")
ControlClick($title, "Setup is ready to begin installing", 'Button1')

; Wait for setup.exe to finish
ProcessWaitClose($ProcessID)

Exit

Func _WinWaitActive($title, $text = '')
    Dim $debug
    If $debug Then
        SplashTextOn('Debug: Waiting for...', 'Title: ' & $title & @CRLF & 'Text: ' & $text, 600, 100, Default, 50)
    EndIf
    WinWait($title, $text)
    WinActivate($title, $text)
    WinWaitActive($title, $text)
    SplashOff()
    Sleep(50)
EndFunc

Not sure if debug window will interrupt the success of installation so use in your Virtual OS to test.

:whistle:

Link to comment
Share on other sites

Found it (and do I feel silly or what). The TrayIconDebug option helped immensely. It wasn't stuck on the window I was looking at, it was waiting for a different window. Originally, I'd placed a check on the Custom Setup window which went to Advanced Customization before Setup is ready... I later removed that checkmark but forgot to take out the Advanced Customization window code. The script was waiting for the Advanced Customization window but the installation now skips that step and was at the Set up is ready... point. I must have tried 20 combinations of things trying to fix a non-existent problem. I may have never noticed that error had it not been for Opt('TrayIconDebug',1). Thank you for that.

@MHz: I didn't get to try your method yet. It looks like it might provide the same information in a separate window during testing. I'll try that. Always good to learn something new.

Thanks.

Ray

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...