Jump to content
Sign in to follow this  
Vanguard

Script re-starts executable in the middle of running

Recommended Posts

Vanguard

The project I'm running to install all three parts of my Cisco project consists of three scripts. The first script runs well (now that I've ironed out my compiling error), but the next script for some reason starts at the beginning.

While I was designing this script, I was simply the blind man, providing responses where I thought the window would require them. As I continued working with it I found that the mouse clicks I was sending were "missing", either because I was mis-timing my Sleeps or because the WaitWinActive commands I was using simply weren't waiting for the window.

To cure this I decided to start using a test to make durn sure when I sent that ControlClick that the click was a success, by using the ControlClick as a function:

CODE
dim $i ; Dim variable

run("C:\Cisco\PartIa\CTIOSsr7.1.4\CTIOS7.1.4.exe") ; Call executable

WinWaitActive("Installer") ;Wait for Installshield window to pop up

Sleep(2000) ;Wait additional two seconds

$i=0 ; Initialize flag

Do

$i=ControlClick("Installer", "", "[CLASS:Button; INSTANCE:2]") ; Call click as function, return mouse click errorcode

sleep(500) ; Wait .5 seconds, in case "missed"

Until $i=1 ; If errorcode is successful, end Do...Until

Sleep(1000) ;Wait 1 second before next instruction

What happens is that the code progresses, and I'm left to guess as to whether or not the Do...Until test is actually working or if the whole thing is falling through, however, the code successfully runs right up until the end of the several pages of "select and click next", where it flat out restarts the entire process.

Is the Do...Until actually restarting my process somehow? Here is the entire code:

CODE
dim $i

run("C:\Cisco\PartIa\CTIOSsr7.1.4\CTIOS7.1.4.exe")

WinWaitActive("Installer") ;Wait for Installshield window to pop up

Sleep(2000) ;Wait additional two seconds

$i=0

Do

$i=ControlClick("Installer", "", "[CLASS:Button; INSTANCE:2]") ;Pass Welcome screen

sleep(500)

Until $i=1

Sleep(1000) ;Wait two seconds

$i=0

Do

$i=ControlClick("Installer", "", "[CLASS:Button; INSTANCE:2]");Pass Admin Rights Required screen

sleep(500)

Until $i=1

Sleep(1000)

$i=0

Do

$i=ControlClick("Installer", "", "[CLASS:Button; INSTANCE:1]");Select "I accept the terms..."

sleep(500)

Until $i=1

Sleep(500)

$i=0

Do

$i=ControlClick("Installer", "", "[CLASS:Button; INSTANCE:4]");Select "Next" past Software Licence window

Sleep(500)

; Continue on to directions window

Until $i=1

Sleep(1000)

$i=0

Do

$i=ControlClick("Installer", "", "[CLASS:Button; INSTANCE:1]");Select "I have read and COMPLETED the directions."

sleep(500)

Until $i=1

$i=0

Sleep(500)

Do

$i=ControlClick("Installer", "", "[CLASS:Button; INSTANCE:4]");Select "Next" past directions window

Sleep(500)

Until $i=1

Sleep(1000)

;sleep(10000) ; Delay waiting for "will be installed in the following location:" screen

$i=0

Do;

$1=ControlClick("Installer", "", "[CLASS:Button; INSTANCE:4]"); "CTIOS7.1(4) will be installed...following location: ...with the following features...

Sleep(500)

Until $i=1

Sleep(10000) ; Wait 10 seconds for install to occur & "Registering CTIOS COM files..." window to pop up

$i=0

Do

$i=ControlClick("Installer", "", "[CLASS:Button; INSTANCE:2]");Select "Next" to begin Registering CTIOS COM files and .NET assemblies into GAC

;send("{SPACE}") ;Begin Registering CTIOS COM files and .NET assemblies into GAC

sleep(1000)

Until $i=1

;sleep(45000) ;Wait 45 seconds for the install to complete

;$i=0

;Do

; $i=ControlClick("Installer", "", "[CLASS:Button; INSTANCE:1]");Select "I have read and COMPLETED the directions."

; sleep(1000)

;Until $i=1

;Sleep(1000)

;$i=0

;Do

; $i=ControlClick("Installer", "", "[CLASS:Button; INSTANCE:4]");Select "Next" past "You may now restart the CTIOS Services..." window

; Sleep(1000)

;Until $i=1

;Send("{SPACE}"); Spacebar on "Finish"

;run("Notepad.exe")

;WinWaitActive("Untitled - Notepad")

;Send("YOU MUST NOW REBOOT")

;send(".")

;send(".")

;send(".")

;send(".")

;send("DO NOT FORGET TO LOAD THE SECOND HALF AFTER REBOOTING!")

Share this post


Link to post
Share on other sites
DaveF

In the very few cases that I've been unable to get a satisfactory silent/unattended install process for a package, I've used a sequential process rather than a loop. You could use ControlClick as you have, but rather than pausing and looping you could use ControlGetText or WinGetText to verify that your install wizard actually advanced to the next pane. The AutoIt v3 Window Info tool in the AutoIt3 program folder can help you determine the names and text from your install wizard.

By testing for text after each click you can add some rudimentary error checking/correction to your script that you wouldn't have with click-this-button-'til-it's-clicked-proper loops.


Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines.

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.