Jump to content

Winactive issue


Recommended Posts

Ok I am trying to automatically install tune up utilities 2008 on a computer but for some reason autoit will not see the windows wether using winwaitactive i've tried process active and I have tried gettting the handle and using that with no luck the script just stops once it get's to an open tune up utilz window. here is the sample of the bigger code with the handle

if WinWaitActive("Open File - Security Warning") then

send("!r")

$handle = WinGetHandle("TuneUp Utilities 2008 Setup", "")

WinWaitActive($handle)

send("!n")

send("!a")

send("!n")

send("!n")

send("!n")

EndIf

Link to comment
Share on other sites

Ok I am trying to automatically install tune up utilities 2008 on a computer but for some reason autoit will not see the windows wether using winwaitactive i've tried process active and I have tried gettting the handle and using that with no luck the script just stops once it get's to an open tune up utilz window. here is the sample of the bigger code with the handle

if WinWaitActive("Open File - Security Warning") then

send("!r")

$handle = WinGetHandle("TuneUp Utilities 2008 Setup", "")

WinWaitActive($handle)

send("!n")

send("!a")

send("!n")

send("!n")

send("!n")

EndIf

You are looking for two windows there, which one is giving you trouble? If you are seeing the first, but not the second, then I think it's a timing issue. There is no "wait" before looking for the second window. I may not be there yet when you try to get the handle.

Also, you didn't ask but: To improve reliability, once you get the window handle use ControlSend() vice Send() wherever possible.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

IM looking for the second window the first window is a stupid windows security run window that opens then that get's closed the issue then is the next program window when it comes up.

Like I said in post #2: You need to wait for the window before getting the handle:
WinWait("TuneUp Utilities 2008 Setup", "")
$handle = WinGetHandle("TuneUp Utilities 2008 Setup", "")
WinWaitActive($handle)

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

I've resorted to this before...

while 1
    if winexists($myhandle)
         do stuff
         exitloop
    endif
  ;(maybe time your loop out here in case the window is never recognized)
wend
Edited by k3v
Link to comment
Share on other sites

>>>> Window <<<<

Title: TuneUp Utilities 2008 Setup

Class: MsiDialogCloseClass

Position: 259, 220

Size: 506, 392

Style: 0x14CA0000

ExStyle: 0x00040100

Handle: 0x002C091C

>>>> Control <<<<

Class:

Instance:

ClassnameNN:

Advanced (Class):

ID:

Text:

Position:

Size:

ControlClick Coords:

Style:

ExStyle:

Handle: 0x00180754

>>>> Mouse <<<<

Position: 754, 226

Cursor ID: 2

Color: 0xFF6250

>>>> StatusBar <<<<

>>>> Visible Text <<<<

&Next >

< &Back

Cancel

Welcome to the

TuneUp Utilities 2008

Installation Wizard

side16

WARNING: This program is protected by copyright law and international treaties.

Click Cancel to quit the setup program, then close any programs you have running. Click Next to continue the installation.

It is strongly recommended that you exit all Windows programs before running this setup program.

Unauthorized reproduction or distribution of this program, or any portion of it, may result in severe civil and criminal penalties, and will be prosecuted to the maximum extent possible under law.

>>>> Hidden Text <<<<

Link to comment
Share on other sites

one final note, I'm sure you already corrected this, but as PsaltyDS mentioned, you do need to wait for the window to be active before you can get its handle... so my earlier loop example would'nt work if you attampted to get the handle before the window was active... try the loop using the window's title.

Link to comment
Share on other sites

  • 4 weeks later...

Ok bringing this back up to see if this is a bug some how or I need something else. I was bored so I started looking at the issue again and found out what is happening. here is the code

Run ( "temp\tune.exe" , "" )
If WinExists("TuneUp Utilities 2008 Setup") Then
    Sleep(5000)
    Send ("!n")
    EndIf

IF I run it that way it does not work now if I add a long enough pause say like this

Run ( "temp\tune.exe" , "" )
sleep(10000)
If WinExists("TuneUp Utilities 2008 Setup") Then
    Sleep(5000)
    Send ("!n")
    EndIf

Then it will send the alt n to move to the next option. I am on winexitst right now because this is when I discovered the issue it works with winwaitactive and everything with the pause the issue is if I set it to win wait active shouldn't it wait till the window is up before killing the script.

What I mean is if it looks like this

Run ( "temp\tune.exe" , "" )
If WinWaitActive("TuneUp Utilities 2008 Setup") Then
    Sleep(5000)
    Send ("!n")
    EndIf

Shouldn't it wait till there is focus on the tune up window

Link to comment
Share on other sites

RunWait( "temp\tune.exe" , "" )
If WinExists("TuneUp Utilities 2008 Setup") Then
    Send ("!n")
EndIf

This should work regardless to if anything is working but I would get the handle of the Window before hand such as

Dim $handle

RunWait( "temp\tune.exe" , "" )

If WinExists( "TuneUp Utilities 2008 Setup") Then
    WinActivate( "TuneUp Utilities 2008 Setup")
    
    $handle = WinGetHandle( "TuneUp Utilities 2008 Setup")
    If @error Then
        MsgBox(4096, "Error", "Could not find the correct window")
    EndIf
EndIf

If $handle Then
;   ControlSend( $handle, , <ControlID>, "!n") or Send("!n)
EndIf

The ControlSend works without the window being active so choose what one you'd like to, I don't know the controlID so you have to know it by check on your windows thing

Contact via MSN: [email=terarink_msn@hotmail.com]terarink_msn@hotmail.com[/email], yahoo: terarink_yah

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