Jump to content

winwaitactive unexpected behaviour


didimons
 Share

Recommended Posts

Hello,

I'v written a script to automatically install an oracle program, the script has 5 steps that call up a dos box as shown in the example below:

RunWait ("X:\p5983622_10123_WINNT\Disk1\setup.exe -responseFile x:\response\install_disco10gr2_win7 -ignoreSysPrereqs -silent", "", @SW_HIDE)
Sleep (20000)
WinWaitActive ("Oracle Universal Installer")
Send ("{ENTER}")
WinWaitClose("Oracle Universal Installer")

the problem is that sometimes the installer doesn't continue because the oracle universal installer window is not in the foreground (e.g.: another dos window has been opened by the user). The installer continues once you click on the oracle universal installer dos window.

I'm trying to find a way around this perticualr issue. I've tried adding Opt("WinTitleMatchMode",3) as seen below:

RunWait ("X:\p5983622_10123_WINNT\Disk1\setup.exe -responseFile x:\response\install_disco10gr2_win7 -ignoreSysPrereqs -silent", "", @SW_HIDE)
Sleep (20000)
Opt("WinTitleMatchMode",3)
WinWaitActive ("Oracle Universal Installer")
Send ("{ENTER}")
WinWaitClose("Oracle Universal Installer")

This doesn't have the desired effect, is the opt parameter a working parameter or is it in the wrong place to get it working ?

According to the autoit v3 windows info the oracle universal installer window has the properties shown below:

Title: Oracle Universal Installer

Class: ConsoleWindowClass

Any feedback will be appreciated

Link to comment
Share on other sites

WinWait("Oracle Universal Installer")
WinActivate("Oracle Universal Installer")
WinWaitActive ("Oracle Universal Installer")
Send ("{ENTER}")

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

thank you for the quick reply, the code works perfectly! However I'm trying to do the same with the next step of the installer that starts a batch file.

In the batch file I give a header to the window name by using the code below in bold:

TITLE opatch_win7_1

Set oracle_home=d:\oracle\disco10gr2

set OPATCH_PLATFORM_ID=215

Set path=%oracle_home%\opatch;%path%

Set path=%path%;%oracle_home%\perl\5.6.1\bin\MSWin32-x86

cd X:\p7277413_10123_WINNT\7277413

x:

perl d:\oracle\Disco10gR2\OPatch\opatch.pl apply

this results in a dos window with the title: Administrator: opatch_win7_1 according to the autoit v3 windows info

I then try the code below to get the same result as with the oracle universal installer window:

Run ("X:\response\opatch_win7_1.bat")
Sleep (10000)
WinWait("Administrator: opatch_win7_1")
WinActivate("Administrator: opatch_win7_1")
WinWaitActive ("Administrator: opatch_win7_1")
Send ("y{ENTER}")
WinWaitClose ("Administrator: opatch_win7_1")

This doesn't seem to work, is the title I'm using incorrect or am I missing a parameter in the winwait commands?

In my previous version I used the script below but had the problem described in my previous post when another dos window was open

Run ("X:\response\opatch_win7_1.bat")
Sleep (10000)
WinWaitActive ("[CLASS:ConsoleWindowClass]")
Send ("y{ENTER}")
WinWaitClose ("[CLASS:ConsoleWindowClass]")
Edited by didimons
Link to comment
Share on other sites

I have found the cause of my problem, in my batch file I used TITLE opatch_win7_1 once this dos box opens it shows at first glance as title Administrator: opatch_win7_1. But apparently an extra space has been added between ":" and "opatch_win7_1" making it Administrator: opatch_win7_1

Modifying my script to include this extra script made it work:

Run ("X:\response\opatch_win7_1.bat")
Sleep (10000)
WinWait("Administrator:  opatch_win7_1")
WinActivate("Administrator:  opatch_win7_1")
WinWaitActive ("Administrator:  opatch_win7_1")
Send ("y{ENTER}")
WinWaitClose ("Administrator:  opatch_win7_1")

thanks for the help

Link to comment
Share on other sites

how can I do this ? I don't have much experience with window handles... The examples I've seen suggest that you have to use the class and text in the window to be able to get the handle but with dosboxes you only get the class ConsoleWindowClass and I can't read anything that is text in a dos box... How does it then know the difference between a dos box that is already open and the dos box that is launched by the batch file ?

Link to comment
Share on other sites

how can I do this ? I don't have much experience with window handles... The examples I've seen suggest that you have to use the class and text in the window to be able to get the handle but with dosboxes you only get the class ConsoleWindowClass and I can't read anything that is text in a dos box... How does it then know the difference between a dos box that is already open and the dos box that is launched by the batch file ?

never mind, found it! thx for the tip
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...