Jump to content

Having to use "Sleep" to get an install script to work


Jarv
 Share

Recommended Posts

Hi,

I wonder if someone could point me in the correct direction for installing software using AutoIT. I am installing some software that installs using InstallShield but for a couple of reasons I cant script it so have turned to AutoIT.

My script works - but not all the time. The key to getting it to work seems to be the odd "sleep" here and there but I am just wondering why

All I normally do is -

** Run the software

run ("e:\data\install\SOFTWARE.EXE")

** I then wait for the first setup windows to appear (although before this it unpacks in a basic InstallShield window)

** I have tried a combination of both but dosent seem to make much odds -

winwait ("Software - InstallShield Wizard)

&

winwaitactive (("Software - InstallShield Wizard)

* I have had slightly more success sticking the following line in -

sleep (5000)

* I then

winactivate ("Software - InstallShield Wizard")

** Again I sleep here to give the window a bit of time **

sleep (5000)

** and then press the Next key (alt and N)

send ("!n")

The software has 5 or 6 screens like this and can fall at any of them but usually the first. Just wondering if I should be using WinWait or WinWaitActive and should I need all the "sleeps"?

Cheers

Link to comment
Share on other sites

If you are going to use Mouse*() or Send() functions then you will need to have active windows to work with. So you first need to wait for the window, so use WinWait(), then you may need to activate the window to ensure success, so use WinActivate() and then you need to wait for the window to become active, so you use WinWaitActive(). Then it would be safe hopefully to now use Mouse*() or Send() functions. I do not see any need for Sleep() in your script.

Link to comment
Share on other sites

Maybe what I say doesn't help you but keep in mind that some programs have a counter to wait until buttons can be pressed. If it's not the case, maybe it's your system that handles the program slowly. Use a TimerInit/TimerDiff to check the time between WinWaitActive() and the effect of Send(). TimerInit on WinWaitActive; use a loop for Send() to nag the application. On WinWaitClose() - TimerDiff. The idea is to see if the time varies.

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