Jump to content

2 Windows same title


Recommended Posts

Hello Everyone. I just downloaded and started to use this product because I've been having some trouble getting IBM's DB2 Run-Time client to install silently. The switches that IBM released to do this simply do not work at all so I have been looking for alternatives. The problem I have happens because there are two windows that start the setup that have the exact same name. The first one pops up and looks exactly like the second one except the Next button is greyed out. Then just a few seconds later the second screen pops up and the Next button is active where you can click on it. I took screen shots of the two windows to show you what I'm dealing with.

This is the first screen with Next greyed out.

Posted Image

Then just a few seconds later the second screen will flash up and you can click on Next.

Posted Image

I was using the WinZip install kind of as a template to help me learn how AutoIT works. So far this is what I have.

Run("setuplite.exe")
WinWaitActive("DB2 Setup wizard - DB2 Run-Time Client Lite")
Send("!N")

My problem comes in to where the first window with Next greyed out is also named DB2 Setup wizard - DB2 Run-Time Client Lite and as soon as that window comes up it tries to press Alt N but Next is greyed out. Is there anyway to make the script wait for a number of seconds after the window comes up in order for me to give enough time for the second window to flash up before it tries to press Next? Thank you for any help anyone could give me.

Link to comment
Share on other sites

  • Developers

You could check with au3info what the control info for the button is and then monitor that control till its enabled with ControlCommand()

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

ControlCommand is the key :D

$sSetupWindowTitle = "DB2 Setup wizard - DB2 Run-Time Client Lite"
Run("setuplite.exe")
WinWaitActive($sSetupWindowTitle)
While 1
; if "&Next >" doesent work use AU3Info to find out what to use
    $iNextState = ControlCommand($sSetupWindowTitle, "", "&Next >", "IsEnabled", "")
    If @error Then
        MsgBox(0, "Error", "...")
        Exit
    EndIf
    If $iNextState Then ExitLoop
    Sleep(250)
WEnd
Send("!N")

edit: i could swear there was no reply to this topic a minute ago... :D

Edited by piccaso
CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map
Link to comment
Share on other sites

Thank you so much for the response. That got me past that problem flawlessly. I still have a lot to learn about writing statements like that because a lot of it is above my head. I'm definately not a programmer but this is at least giving me the opportunity to learn something. Now I thought i would bring my second issue to you and see if yall had any ideas how to do this better.

Right now i am finished with the install of the DB2 Run-Time client but now I have to configure an ODBC data source. I first tried it with importing a registry key but the IBM ODBC driver works differently than the HiT one I had been using. The HiT driver always puts the registry key in the same place, but the IBM driver has a differnt registry key depending on the machine its installed on. So my registy key idea wont work. Next I decided I would just use AutoIT to do all of my commands for me for setting up the ODBC data source. In the script i am writing Here is what I have so far.

Run("odbcad32.exe")
WinWaitActive ( "ODBC Data Source Administrator")
Send("!d")
Send("IBM")
Send("{Enter}")

It launches the ODBC Adminstrator fine and selects Add, then it chooses the IBM ODBC Driver and hits Enter. Now the next part I can't figure out what is happening.

If I use the script I get this window

Posted Image

If i dont use the script I get this window

Posted Image

What is supposed to happen is I should get the second window andbe able to type a name in Data Souce name and then click on Add but using the script i dont get that option. I'm truely stumped for what could be causing this. Thank you for any insight anyone may have.

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...