Jump to content

Am I Just Plain Stupid, or, why doesn't everyone have this problem

Recommended Posts

Hi there,

I have just spent one hard week trying to use AutoIt to generated unattended installations of various applications. No matter how hard I try, the scripts generated do not run consistently. By consistently, I mean:

1) Installing the application in a fresh partition. That is, the application has never been installed in it. This is to avoid problems with any "stuff" leftover from any uninstallation.

2) Use the recorder to record mouse/keyboard operations. Mouse is recorded for "moving the installation along", i.e. Next, etc. Keyboard operation is used to input serial info, etc.

3) Check syntax - which has never found a problem - compile and save source and compiled code.

4) Run script in a FRESH partition, i.e. one not having the application installed, only to get...

5) A script that sometimes runs and other times watch the mouse wander to the wrong place or the keyboard input go to the wrong window. A classic case is the WinRar installation. The last window remains up...sometimes, sometimes not. WinRar is a "well behaved" install having unique window titles and changing text. Sure, other installs aren't so "well behaved" and Yyes, I have info'd the windows. Yes, many of them do not have text and the title doesn't change. Yes, the title does change but only after a series of operations on the currently active window. Yes, I have looked for clues, hints, basic things to look for. No, I haven't found them and WinRar continues to be the simplest example of inconsistent operation.

So, does all this simply mean a delay needs to be put in after every mouse/keyboard operation? If so, how long? If not, what am I doing wrong? Or is this all a big chemistry lab where one has to experiment endlessly and hope the right combo is found so that the script will run reliably every time? One is led to believe that simply doing an installation and recording the actions will provide a reliable, repeatable installation script but I have found this to be very, very far from the case.

So blast away! Tell me I missed the obvious and that if I simply do suchandsuch all will be well always.


Link to post
Share on other sites

Don't record mousemovements, or use window "active" commands. Instead, use window "exists" commands, and send clicks to the controls/buttons programmatically. I think the WinZip installation example in the help file is what most people go off of the first time they automate an installation, but that's not what you want to do.

Use these commands: ControlClick, ControlCommand, ControlGetText, ControlSetText, WinWait, WinExists, WinClose, WinWaitClose, and you should get consistent results.

Another idea to try is using a loop and Select/Case statement. like so:

  while 1
    case WinExists("Confirmation","Are you sure")
       ControlClick("Confirmation","Are you sure","Button2")
       While WinExists("Confirmation","Are you sure")
    case WinExists("Installation Complete","Installation completed succ")
        ControlClick("Installation Complete","Installation completed succ","Button1")
        While WinExists("Installation Complete","Installation completed succ")

I've had to do that for some programs (notably, NetMeeting) where there is not a consistent progression of dialogs from machine to machine. If you do it this way, you can handle any dialog that pops up (that you've seen before) and treat it accordingly. To get the information as to which button ID to send the ControlClick, use the AutoitWindowInfo tool that comes with AutoIt.

Edited by lod3n

[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

Link to post
Share on other sites

lod3n: much thanks for the advice. Yes, you are correct. WinZip was the basic guide. I do admit to having some misgivings as it seems there is a strong hint that ControlClick is the more reliable approach. I will definitely switch to it along with your other suggestions and again, much thanks. :">

Link to post
Share on other sites

Seriously, guys, a code example is not always required, especially if the poster is asking a general question about the theoretical underpinnings of a well understood methodology.

Seeing his code in this case is totally useless anyway. His original method was fundamentally flawed, and impossible to reproduce accurately. What could you actually do with code full of Sleeps and MouseClicks? Nothing.

[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...