Jump to content

Automate EXE installation with wait option


amaged
 Share

Recommended Posts

Hi,

 

I have a complex EXE installation that needs to be automated. The behavior is as below: 

  1. Right lick on the executable and choose Run As Administrator
  2. click "yes" on UAC window

AIT.jpg

3- Window A will appear, click on "Clean and Install"

3.png

4- this will remove and clean older version of the software
4.png

5- once clean up is complete, a new windows, Window B, will popup , click Next to start the installation
5.png

6 - once installation is complete, click on Finish
6.png

7- Window A will popup a message box with Complete, Click on OK

7.png

8- Click on Close on window A

Link to comment
Share on other sites

Welcome to AutoIt and the forum!

Doesn't this software provide a silent installation option?
Please have a look at the help file for InstallShield.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

1 minute ago, water said:

Welcome to AutoIt and the forum!

Doesn't this software provide a silent installation option?
Please have a look at the help file for InstallShield.

HI,

Unfortunately I have tried setup /r to record/script the action during installation but the the setup.iss does not get generated (I have used /f1 switch to specify a path but that did not work either)

Thanks

Link to comment
Share on other sites

  • Moderators

If this is a commercially available application (as it appears to be, being an InstallShield package) how about specifying the name rather than going through all of the redacting? Perhaps some of us on the forum who have been repackaging applications for 20 years could give you some better suggestions, or try things out, based on what app you're trying to install ;)

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

14 hours ago, JLogan3o13 said:

If this is a commercially available application (as it appears to be, being an InstallShield package) how about specifying the name rather than going through all of the redacting? Perhaps some of us on the forum who have been repackaging applications for 20 years could give you some better suggestions, or try things out, based on what app you're trying to install ;)

 

Thanks for your comment. The software is build on top of Sage 300 , it's an HIS/ERP application. The development company though (Named MimSYS) did a horrible job not being able to provide a usable MSI . it's a custom made installation that uses 2 steps as I have clarified in the original post, using standard switches does not seem to be working. I have used the Autoit recorder to record the changes but it's not consistent as it's heavily dependent on the mouse click coordination

Link to comment
Share on other sites

On 12/23/2017 at 0:22 PM, amaged said:

I have posted the buttons information below each image here. thank you so much for your help

AIT.jpg

 

Quote

 

3- Window A will appear, click on "Clean and Install"
 

3.png

Clean and Install button

>>> Window <<<<
Title:  MIMSys Install
Class:  WindowsForms10.Window.8.app.0.378734a
Position:   513, 206
Size:   654, 465
Style:  0x16CF0000
ExStyle:    0x00050100
Handle: 0x0007015E

>>>> Control <<<<
Class:  WindowsForms10.BUTTON.app.0.378734a
Instance:   2
ClassnameNN:    WindowsForms10.BUTTON.app.0.378734a2
Name:   
Advanced (Class):   [CLASS:WindowsForms10.BUTTON.app.0.378734a; INSTANCE:2]
ID: 197240
Text:   Clean and Install
Position:   7, 405
Size:   109, 23
ControlClick Coords:    42, 13
Style:  0x5601000B
ExStyle:    0x00000000
Handle: 0x00030278

>>>> Mouse <<<<
Position:   566, 647
Cursor ID:  0
Color:  0xD6D3CE

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
Close
IDMSys Registry:
PROCESSOR ARCHITECTURE: 64 Bit    Accpac Program path: C:\Sage\Sage 300 ERP\Programs
Clean and Install


>>>> Hidden Text <<<<

4- this will remove and clean older version of the software
4.png

5- once clean up is complete, a new windows, Window B, will popup , click Next to start the installation
5.png

Next button

>>>> Window <<<<
Title:  MIMSYS HIS ERP SETUP - InstallShield Wizard
Class:  #32770
Position:   588, 272
Size:   504, 379
Style:  0x94C800C4
ExStyle:    0x00010101
Handle: 0x000B0296

>>>> Control <<<<
Class:  Button
Instance:   1
ClassnameNN:    Button1
Name:   
Advanced (Class):   [CLASS:Button; INSTANCE:1]
ID: 1
Text:   &Next >
Position:   323, 319
Size:   75, 23
ControlClick Coords:    37, 12
Style:  0x50030001
ExStyle:    0x00000004
Handle: 0x000D00A6

>>>> Mouse <<<<
Position:   951, 625
Cursor ID:  0
Color:  0xD6D3CE

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
&Next >
Cancel
< &Back
The InstallShield Wizard will install MIMSYS HIS ERP SETUP on your computer.  To continue, click Next.
Welcome to the InstallShield Wizard for MIMSYS HIS ERP SETUP


>>>> Hidden Text <<<<
C

 

install.png

the Install button
 

>>>> Window <<<<
Title:  MIMSYS HIS ERP SETUP - InstallShield Wizard
Class:  #32770
Position:   588, 272
Size:   504, 379
Style:  0x94C800C4
ExStyle:    0x00010101
Handle: 0x000C0296

>>>> Control <<<<
Class:  Button
Instance:   1
ClassnameNN:    Button1
Name:   
Advanced (Class):   [CLASS:Button; INSTANCE:1]
ID: 1
Text:   &Install
Position:   323, 319
Size:   75, 23
ControlClick Coords:    34, 19
Style:  0x50010000
ExStyle:    0x00000004
Handle: 0x000E00E6

>>>> Mouse <<<<
Position:   948, 632
Cursor ID:  0
Color:  0xD6D3CE

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
&Install
Cancel
< &Back
Click Install to begin the installation.

If you want to review or change any of your installation settings, click Back. Click Cancel to exit the wizard.
The wizard is ready to begin installation.
Ready to Install the Program


>>>> Hidden Text <<<<
C

6 - once installation is complete, click on Finish
6.png

The Finish button

>>>> Window <<<<
Title:  MIMSYS HIS ERP SETUP - InstallShield Wizard
Class:  #32770
Position:   588, 272
Size:   504, 379
Style:  0x94C000C4
ExStyle:    0x00010101
Handle: 0x000E0296

>>>> Control <<<<
Class:  Button
Instance:   4
ClassnameNN:    Button4
Name:   
Advanced (Class):   [CLASS:Button; INSTANCE:4]
ID: 1
Text:   Finish
Position:   323, 319
Size:   75, 23
ControlClick Coords:    39, 13
Style:  0x50010001
ExStyle:    0x00000004
Handle: 0x00070224

>>>> Mouse <<<<
Position:   953, 626
Cursor ID:  0
Color:  0x000000

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
< &Back
Finish
Cancel
The InstallShield Wizard has successfully installed MIMSYS HIS ERP SETUP.  Click Finish to exit the wizard.
InstallShield Wizard Complete


>>>> Hidden Text <<<<
Yes, I want to view the ReadMe file.
Yes, I want to launch %p now.

7- Window A will popup a message box with Complete, Click on OK

7.png

The OK button

>>>> Window <<<<
Title:  
Class:  #32770
Position:   782, 398
Size:   123, 126
Style:  0x94C801C5
ExStyle:    0x00010101
Handle: 0x05820280

>>>> Control <<<<
Class:  Button
Instance:   1
ClassnameNN:    Button1
Name:   
Advanced (Class):   [CLASS:Button; INSTANCE:1]
ID: 2
Text:   OK
Position:   35, 68
Size:   75, 23
ControlClick Coords:    28, 10
Style:  0x50030000
ExStyle:    0x00000004
Handle: 0x00100296

>>>> Mouse <<<<
Position:   848, 498
Cursor ID:  0
Color:  0xD6D3CE

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
OK
Completed.


>>>> Hidden Text <<<<

close.png

The Close button
 

>>>> Window <<<<
Title:  MIMSys Install
Class:  WindowsForms10.Window.8.app.0.378734a
Position:   513, 206
Size:   654, 465
Style:  0x16CF0000
ExStyle:    0x00050100
Handle: 0x0007015E

>>>> Control <<<<
Class:  WindowsForms10.BUTTON.app.0.378734a
Instance:   1
ClassnameNN:    WindowsForms10.BUTTON.app.0.378734a1
Name:   
Advanced (Class):   [CLASS:WindowsForms10.BUTTON.app.0.378734a; INSTANCE:1]
ID: 262778
Text:   Close
Position:   525, 405
Size:   109, 23
ControlClick Coords:    45, 11
Style:  0x5601000B
ExStyle:    0x00000000
Handle: 0x0004027A

>>>> Mouse <<<<
Position:   1087, 645
Cursor ID:  0
Color:  0xD6D3CE

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
Close
Status:
---Completed---
Clean and Install


>>>> Hidden Text <<<<

 

 

Link to comment
Share on other sites

Now use WinWait and ControlClick to automate the installation :)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

this is the one I have generated using the the AU3Recorder > I know it  might looks really stupid :(

Run('C:\Client\Setup - ReInstallMIMSys.exe')
_WinWaitActivate("MIMSys Install","")
MouseClick("left",265,13,1)
MouseClick("left",97,440,1)
_WinWaitActivate("MIMSYS HIS ERP SETUP - InstallShield Wizard","")
MouseClick("left",289,9,1)
MouseClick("left",270,10,1)
MouseClick("left",362,352,1)
MouseClick("left",227,9,1)
MouseClick("left",361,349,1)
MouseClick("left",204,13,1)
MouseClick("left",360,348,1)
_WinWaitActivate("classname=#32770","")
MouseClick("left",82,101,1)
_WinWaitActivate("MIMSys Install","")
MouseClick("left",371,12,1)
MouseClick("left",597,441,1)

 

Link to comment
Share on other sites

Now replace MouseClick with ControlClick. As each ControlClick triggers an action you should then add a WinWait for the action to complete.
Windows Forms might be a problem but I think it should be solveable by UIAutomation.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

5 minutes ago, water said:

Now replace MouseClick with ControlClick. As each ControlClick triggers an action you should then add a WinWait for the action to complete.
Windows Forms might be a problem but I think it should be solveable by UIAutomation.

like this ?
is there any problem with these coordination? is it relative to the open window or for the full desktop ?
appreciate your patience and help

Run('C:\Client\Setup - ReInstallMIMSys.exe')
_WinWaitActivate("MIMSys Install","")
ControlClick("left",265,13,1)
ControlClick("left",97,440,1)
_WinWaitActivate("MIMSYS HIS ERP SETUP - InstallShield Wizard","")
ControlClick("left",289,9,1)
ControlClick("left",270,10,1)
ControlClick("left",362,352,1)
ControlClick("left",227,9,1)
ControlClick("left",361,349,1)
ControlClick("left",204,13,1)
ControlClick("left",360,348,1)
_WinWaitActivate("classname=#32770","")
ControlClick("left",82,101,1)
_WinWaitActivate("MIMSys Install","")
ControlClick("left",371,12,1)
ControlClick("left",597,441,1)
Quote

 

 

Link to comment
Share on other sites

You should carefully read the help file for ControlClick and which parameters this function needs ;) 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

16 minutes ago, water said:

You should carefully read the help file for ControlClick and which parameters this function needs ;) 

I will definitely invest a full day studying the tools and commands, unfortunately I have to decide today if it can be automated or I will be faced with my 2 colleagues with a thousand machine installation overnight :/
 

Link to comment
Share on other sites

Then start with this code snippet. If this works then everything else should work as well.

#RequireAdmin
Run("C:\Client\Setup - ReInstallMIMSys.exe")
$hWindow = WinWait("MIMSys Install")
$iReturnValue = ControlClick($hWindow, "", "[CLASS:WindowsForms10.BUTTON.app.0.378734a; INSTANCE:2]")
If $iReturnValue = 1 Then 
    MsgBox(0, "Status", "Success!")
Else
    MsgBox(0, "Status", "Did not work!")
EndIf

 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

3 minutes ago, water said:

Then start with this code snippet. If this works then everything else should work as well.

#RequireAdmin
Run("C:\Client\Setup - ReInstallMIMSys.exe")
$hWindow = WinWait("MIMSys Install")
$iReturnValue = ControlClick($hWindow, "", "[CLASS:WindowsForms10.BUTTON.app.0.378734a; INSTANCE:2]")
If $iReturnValue = 1 Then 
    MsgBox(0, "Status", "Success!")
Else
    MsgBox(0, "Status", "Did not work!")
EndIf

 

Thaaaank you so much! that did work for the first step! so I think i should remove the if statement and repeat the same for window B as below ?
 

$iWindow = WinWait ("MIMSYS HIS ERP SETUP - InstallShield Wizard")
ControlClick($iWindow, "" , "[CLASS:Button; INSTANCE:1]")

 

Link to comment
Share on other sites

Correct.

Clicking the button starts an action. You should wait until the action has finished before clicking the next button.
"action has finished" most of the time - but not always - means that a new window gets displayed. But it could be a text label on the same window or a button getting activated etc. as well.

Based on your screenshots the next step should be to wait for window "MIMSYS HIS ERP SETUP - InstallShield Wizard" and then click on the "Next" button.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

well, using the below with WinWait did not trigger the Next button in step 2 , am I missing anything here ?
 

Run("C:\Client\Setup - ReInstallMIMSys.exe")
$hWindow = WinWait("MIMSys Install")
$iReturnValue = ControlClick($hWindow, "", "[CLASS:WindowsForms10.BUTTON.app.0.378734a; INSTANCE:2]")
$iWindow = WinWait ("MIMSYS HIS ERP SETUP - InstallShield Wizard")
ControlClick($iWindow, "" , "[CLASS:Button; INSTANCE:1]")

Thank you

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