Sign in to follow this  
Followers 0
jben

Automating software issue

8 posts in this topic

Hi everyone,

Been real busy for a while and never really got chance to play with AutoIT. Anyways i'm not back to using it but struggling with something, so thought I would post here.

Basically I have created a script that automates a software installation. I have used winwait,winwaitactive and controlclick.

But I have a problem. The script installs the software fine. However there is the possibility that another form may pop up (dependant on the computer). I have used the winwaitactive on this and it works fine.

Only problem is, it will not work on the PC that the form pop doesn't appear on.

So basically, i'm wondering if theres code that will enable me to wait for it to pop up and if it doesn't then proceed with the next line of code. I know I can put a timeout on with winwait but I don't feel comfortable with that.

Any help will be much appreciated. Thanks

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

If the pop up doesn't take long to show up then:

...

; Possibility of pop up
Sleep(1000)
If WinExists("pop-up") Then
...
EndIf

...

EDIT: Or:

For $i = 1 To 1000
If WinExists("pop up") Then
...
EndIf
Next
Edited by Aassdd

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

You can use AdlibEnable() function. The code below is what I use to avoid Open File - Security Warining window.

AdlibEnable('_WinTitle')
    Run(@ScriptDir & "\daemon410-x86.exe", @TempDir, @SW_SHOW)
    WinWait("DAEMON Tools 4.10 (32 bit)","Welcome to the DAEMO")

;~ From here continue the next steps of your script to install Daemon.

AdlibDisable()

Func _WinTitle()
    If WinActive('Open File - Security Warning') Then ControlClick('Open File - Security Warning',"","&Run")
EndFunc
Edited by Danny35d

AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line

Share this post


Link to post
Share on other sites

Thanks, that seems to close the pop up if it appears, but then it gets stuck at the next point. I have posted my code below

WinWaitActive ("BulletProof FTP Server v2.15 Setup: Installation Directory","Select the directory to install BulletProof FTP Server v2.15 in:")

$ReturnedValue = ControlClick("BulletProof FTP Server v2.15 Setup: Installation Directory","", "Next >","Button1")

for $i = 1 to 1000

if winwaitactive ("Tip of the Day","&Show Tips at Startup") then

ControlClick("Tip of the Day","", "&Show Tips at Startup","TCheckBox1")

ControlClick("Tip of the Day","", "&OK","TButton1")

EndIf

next

WinWaitActive ("BulletProof FTP Server v2.15 ::UNREGISTERED:: 30 day(s) left for evaluation","BulletProof FTP Server v2.15 - Copyright © 1998-2001 Gene6, All Rights Reserved.")

winkill ("BulletProof FTP Server v2.15 ::UNREGISTERED:: 30 day(s) left for evaluation","BulletProof FTP Server v2.15 - Copyright © 1998-2001 Gene6, All Rights Reserved.")

If the pop up doesn't take long to show up then:

...

; Possibility of pop up
Sleep(1000)
If WinExists("pop-up") Then
...
EndIf

...

EDIT: Or:

For $i = 1 To 1000
If WinExists("pop up") Then
...
EndIf
Next

Share this post


Link to post
Share on other sites

I've also tried your code. But still can't seem to get it working. Here is what i've got (This is just part of the code and I have put AdLibEnable(_WinTitle) and AdLibDisable at the top of my code.

WinWaitActive ("BulletProof FTP Server v2.15 Setup: Installation Directory","Select the directory to install BulletProof FTP Server v2.15 in:")
$ReturnedValue = ControlClick("BulletProof FTP Server v2.15 Setup: Installation Directory","", "Next >","Button1")


Func _WinTitle()
    If WinActive("Tip of the Day","&Show Tips at Startup") Then ControlClick("Tip of the Day","","&Show Tips at Startup","TCheckBox1")
EndFunc


WinWaitActive ("BulletProof FTP Server v2.15 ::UNREGISTERED:: 30 day(s) left for evaluation","BulletProof FTP Server v2.15 - Copyright (c) 1998-2001 Gene6, All Rights Reserved.")
;win kill will close the application after installation is complete
winkill ("BulletProof FTP Server v2.15 ::UNREGISTERED:: 30 day(s) left for evaluation","BulletProof FTP Server v2.15 - Copyright (c) 1998-2001 Gene6, All Rights Reserved.")

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I downloaded BulletProof FTP. The reason it didn't work is because the Tip window is not active.

Give it a try:

Opt("WinTitleMatchMode", 4)
AdlibEnable('_WinTitle')
WinWait("Setup - BulletProof FTP Server","This will install BulletProof ")
ControlClick("Setup - BulletProof FTP Server","This will install BulletProof ","TNewButton1")
WinWait("Setup - BulletProof FTP Server","Please read the following impo")
ControlClick("Setup - BulletProof FTP Server","Please read the following impo","TNewRadioButton1")
ControlClick("Setup - BulletProof FTP Server","Please read the following impo","TNewButton2")
WinWait("Setup - BulletProof FTP Server","Where should BulletProof FTP S")
ControlClick("Setup - BulletProof FTP Server","Where should BulletProof FTP S","TNewButton3")
WinWait("Setup - BulletProof FTP Server","Which components should be ins")
ControlClick("Setup - BulletProof FTP Server","Which components should be ins","TNewButton3")
WinWait("Setup - BulletProof FTP Server","Where should Setup place the p")
ControlClick("Setup - BulletProof FTP Server","Where should Setup place the p","TNewButton4")
WinWait("Setup - BulletProof FTP Server","Which additional tasks should ")
ControlClick("Setup - BulletProof FTP Server","Which additional tasks should ","TNewButton4")
WinWait("Setup - BulletProof FTP Server","Setup is now ready to begin in")
ControlClick("Setup - BulletProof FTP Server","Setup is now ready to begin in","TNewButton4")
WinWait("Setup - BulletProof FTP Server","Setup has finished installing ")
ControlClick("Setup - BulletProof FTP Server","Setup has finished installing ","TNewButton4")
WinWait("Tip of the Day","&Show Tips at Startup")
AdlibDisable()

Func _WinTitle()
    If WinActive('Open File - Security Warning') Then ControlClick('Open File - Security Warning',"","&Run")
    If WinExists("Tip of the Day","&Show Tips at Startup") Then 
        WinSetState("Tip of the Day","&Show Tips at Startup", @SW_SHOW)
        ControlClick("Tip of the Day","&Show Tips at Startup","TButton1")
    EndIf
EndFunc
Edited by Danny35d

AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line

Share this post


Link to post
Share on other sites

Nice one Danny, that worked a treat. Thanks

How did you know that the tip window is not active though?, just out of curiosity (yeah i'm learning)

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