Sign in to follow this  
Followers 0
Steve M

Noob, there must be a cleaner way

7 posts in this topic

Hi all. I'm new to AutoIt, and man I wish I'd tried it sooner, it's gonna be a lifesaver.

I have a script to install an app that can't be repackaged. It's working great, but it's a bit sloppy.

I'm not a programmer by any stretch.

It's going through the install, waiting for windows to appear and happily clicking radio buttons, and next etc.

Once all the buttons are pushed it merrily installs for about a minute, then at the end we either get a window that says something like "Installation Complete, click finish" or Reboot required, click yes or no"

I want to click finish, or no to the reboot at the end.

Here's how I'm dealing with it.

$done=0

$reboot=0

$loop=0

While $loop=0

$done= WinExists("ProSystem fx Practice Management Setup", "Installation Complete")

$reboot=WinExists("ProSystem fx Practice Management Setup", "A reboot")

If $done==1 then

ControlClick("ProSystem fx Practice Management Setup", "", "Button2")

$loop=1

ElseIf $reboot==1 then

ControlClick("ProSystem fx Practice Management Setup", "", "Button3")

ControlClick("ProSystem fx Practice Management Setup", "", "Button2")

$loop=1

Endif

sleep(2000)

WEnd

Sloppy I know, and the while loop slows down the install process a bit.

Any suggestions for a more efficient way to do things?

Thanks,

Steve

Share this post


Link to post
Share on other sites



What is the point of the whole code? I'm not seeing why you would want to install it more than once...

you could make it an option if you want to reboot or not with a msgbox or inputbox :)


What goes around comes around... Payback's a bitch.

Share this post


Link to post
Share on other sites

This basically does the same thing, its just a little cleaner.

While 1
    $bDone = WinExists("ProSystem fx Practice Management Setup", "Installation Complete")
    $bReboot = WinExists("ProSystem fx Practice Management Setup", "A reboot")
    
    If $bDone Then
        ControlClick("ProSystem fx Practice Management Setup", "", "Button2")
        ExitLoop
    ElseIf $bReboot Then
        ControlClick("ProSystem fx Practice Management Setup", "", "Button3")
        ControlClick("ProSystem fx Practice Management Setup", "", "Button2")
        ExitLoop
    EndIf
    Sleep(100)
WEnd

Share this post


Link to post
Share on other sites

What is the point of the whole code? I'm not seeing why you would want to install it more than once...

you could make it an option if you want to reboot or not with a msgbox or inputbox :D

Guess I wasn't clear... I'm automating an app install so when my 80 users log in, this app installs unattended. Our users are used to totally unattended app installs. Asking them to click anything other than the login button, it asking a lot , In fact I'd prefer they don't :)

Speaking of which, is there a function to disable user input during script run? I'll read the help :P

I'm not sure why some systems want to reboot at the end and others don't. I could go looking to solve that (probably a .net framework issue) but I don't really have the time, hence my attempt to trap both windows at the end of the install, and click accordingly. And the app runs just fine if you say no to reboot. Go figure...

Share this post


Link to post
Share on other sites

This basically does the same thing, its just a little cleaner.

[

Looks great. Thanks! Guess I missed the Exitloop in the docs. (stoopid noob set a variable to get out...)

Share this post


Link to post
Share on other sites

BlockInput(1) and BlockInput(0) Completely blocks user input while it is set to one. :)


- Dan [Website]

Share this post


Link to post
Share on other sites

Guess I wasn't clear... I'm automating an app install so when my 80 users log in, this app installs unattended. Our users are used to totally unattended app installs. Asking them to click anything other than the login button, it asking a lot , In fact I'd prefer they don't :)

Your using the WinWait() and Control*() functions which is good. You could just use Group Policy and just use your au3 script as a logon script. The 80 users will just see a delayed logon ui.

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