Sign in to follow this  
Followers 0
Stuempi

WinActive/WinWaitActive Problems

5 posts in this topic

Hi there...

I'm sure this is just a minor problem, but I'm obviously to dumb to see the answer myself :D

So I got a niftly little uninstallation of a program... Window A pops up ("Remove Programs From Your Computer") and the uninstallation is beginning to run with a progress bar... after about 10% if COULD BE that a window appears ("Remove Shared File?") about some kind of shared files which I want wo agree by pressing enter. Otherwise I want to wait till the uninstallation is completed and then want to press enter.

Run('C:\WINDOWS\IsUninst.exe -f"C:\Programme\test\Uninst.isu"')
WinWaitActive("Confirm File Deletion", "") 
Send("{ENTER}")
If  WinActive("Remove Shared File?","") Then
    Send("{Enter}")
    WinWaitActive("Remove Programs From Your Computer","")
    Sleep(5000)
    Send("{Enter}")
Else 
    WinWaitActive("Remove Programs From Your Computer","")
    Sleep(5000)
    Send("{Enter}")
EndIf

Exit

But obviously this isn't working as intended... I hope you guys get me and have a nice idea how to solve this little problem...

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Would something like this work for you?

Run('C:\WINDOWS\IsUninst.exe -f"C:\Programme\test\Uninst.isu"')
While 1
    If WinExists("Confirm File Deletion", "") Then Send("{Enter}")
    If WinExists("Remove Shared File?", "") Then Send("{Enter}")
    If WinExists("Uninstall Completed (or something like that???)", "") Then
        Sleep(5000)
        Send("{Enter}")
        ExitLoop
    EndIf
    Sleep(50)
WEnd
Exit
Edited by Jos

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

#3 ·  Posted (edited)

Hi there...

I'm sure this is just a minor problem, but I'm obviously to dumb to see the answer myself :D

So I got a niftly little uninstallation of a program... Window A pops up ("Remove Programs From Your Computer") and the uninstallation is beginning to run with a progress bar... after about 10% if COULD BE that a window appears ("Remove Shared File?") about some kind of shared files which I want wo agree by pressing enter. Otherwise I want to wait till the uninstallation is completed and then want to press enter.

Run('C:\WINDOWS\IsUninst.exe -f"C:\Programme\test\Uninst.isu"')
WinWaitActive("Confirm File Deletion", "") 
Send("{ENTER}")
If  WinActive("Remove Shared File?","") Then
    Send("{Enter}")
    WinWaitActive("Remove Programs From Your Computer","")
    Sleep(5000)
    Send("{Enter}")
Else 
    WinWaitActive("Remove Programs From Your Computer","")
    Sleep(5000)
    Send("{Enter}")
EndIf

Exit

But obviously this isn't working as intended... I hope you guys get me and have a nice idea how to solve this little problem...

One way is to have an AdLibEnable() function that periodically checks for the popup and handles it:
AdlibEnable("_PopupGuard", 500); Test for popup every .5sec

Run('C:\WINDOWS\IsUninst.exe -f"C:\Programme\test\Uninst.isu"')
WinWaitActive("Confirm File Deletion", "")
ControlSend("Confirm File Deletion", "", "", "{ENTER}")
WinWaitActive("Remove Programs From Your Computer", "")
Sleep(5000)
ControlSend("Remove Programs From Your Computer", "", "", "{Enter}")


Func _PopupGuard()
    If WinExists("Remove Shared File?", "") Then
        WinActivate("Remove Shared File?", "")
        ControlSend("Remove Shared File?", "", "", "{Enter}")
        Sleep(1000); Give it time to go away
    EndIf
EndFunc ;==>_PopupGuard

I also recommend you use ControlSend() vice Send(), but that's optional.

:D

Edit: Rats! Beaten to it by the Jos-bot!

Edited by PsaltyDS

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

Share this post


Link to post
Share on other sites

I think I got the idea from both of you, but didn't get Jos' Code working :D

I'm new to all this and I'm not sure about the expression "1" as in the help file it's declared as "if the expression is true the code is run till WEnd. The loop continues until the expression isn't true"... ^_°

PsaltyDS's code solved my problem :D

Many thanks to both of you.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

@ Stuempi

That's why Jos uses the ExitLoop as the only way to stop the while loop (otherwise it will run forever, yes)

Don't doubt the developer :D

Edited by Inverted

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