Jump to content

Creating a script to auto install a program.


Eric13
 Share

Recommended Posts

I've been browsing through the forums and tutorials the past week to get a simple program to install. I've looked at ControlClick, Send, ControlSend, and MouseClick to get the install to hit 'Next' on the install.

For example here is a script I tried.

Run('\\installs1\Public\cView\cv11-rc.exe')
WinWait("cView - InstallShield Wizard", "WARNING: This Program is protected by copyright law")
ControlClick("cView - InstallShield Wizard", "WARNING: This Program is protected by copyright law", "[CLASS:Button; INSTANCE:1]", "left")

Now...bare with me as I'm only getting into coding. I will continue researching this until I find something that works. So then I can get other programs that we have at our company to do the same.

Here is the information from AutoIT Window Info

>>>> Window <<<<

Title: cView - InstallShield Wizard

Class: MsiDialogCloseClass

Position: 388, 301

Size: 504, 382

Style: 0x14C80000

ExStyle: 0x00040100

Handle: 0x00000000000108F8

>>>> Control <<<<

Class: Button

Instance: 1

ClassnameNN: Button1

Name:

Advanced (Class): [CLASS:Button; INSTANCE:1]

ID: 8543

Text: &Next >

Position: 306, 324

Size: 88, 22

ControlClick Coords: 40, 7

Style: 0x50032001

ExStyle: 0x00000000

Handle: 0x0000000000010904

>>>> Mouse <<<<

Position: 737, 657

Cursor ID: 2

Color: 0xE1F3FC

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<

&Next >

Cancel

< &Back

WARNING: This program is protected by copyright law and international treaties.

The InstallShield® Wizard will install cView on your computer. To continue, click Next.

NewBinary5

Welcome to the InstallShield Wizard for cView

>>>> Hidden Text <<<<

Too me, from what I have read that code should 'click' the next button on my install, but I'm missing something and I just do not understand what it is.

Link to comment
Share on other sites

I would suggest to use the InstallShield command line switches to do a silent install. No need to click through the install process.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

I would suggest to use the InstallShield command line switches to do a silent install. No need to click through the install process.

I briefly looked into that, so I'll check it out again. So far I haven't been able to get it to give me the .iss file needed. I might have to come back to this... I run the setup with /r. Go through the prompts, but cannot find the .iss file afterwards.

Link to comment
Share on other sites

Yes, you could use

$sTitle="cView - InstallShield Wizard"

controlclick($sTitle,"","&Next")

, or it might be

$sTitle="cView - InstallShield Wizard"
controlclick($sTitle,"","&Next >")

Eric,

Check out my post I posted a script that did an auto install for me (had to auto the install GUI as the manufacture didn't build any command line options).

Got it working guys! Now I just have a couple more 'Next' to add in then a radio button and I'll be done. Here is the code, I took both of your alls and combined them to make mine after trying a couple things.

Run('\\installs1\Public\cView\cv11-rc.exe')
$sTitle="cView - InstallShield Wizard"
WinWait("cView - InstallShield Wizard")
ControlClick($sTitle,"", "&Next >")

I didn't think to use '$stitle', I kept seeing it, but wasn't sure. Thanks again though!

Link to comment
Share on other sites

Okay guys, last thing. It trips me up, I have this code now.

Run('\\installs1\Public\cView\cv11-rc.exe')
$sTitle="cView - InstallShield Wizard"
WinWait("cView - InstallShield Wizard")
ControlClick($sTitle,"", "&Next >")
ControlClick($sTitle,"", "[CLASS:Button;INSTANCE:3]")
ControlClick($sTitle,"", "&Next >")
ControlClick($sTitle,"", "&Next >")
ControlClick($sTitle,"", "&Next >")
ControlClick($sTitle,"", "&Next >")
ControlClick($sTitle,"", "&Install")
ControlClick($sTitle,"", "&Finish")

It will go through the entire install just fine, however for the last 'ControlClick' it will not send the Finish. I tried 'WinWait', but I found that will mess my code up in a various places for some reason.

Link to comment
Share on other sites

Okay guys, last thing. It trips me up, I have this code now.

Run('\\installs1\Public\cView\cv11-rc.exe')
$sTitle="cView - InstallShield Wizard"
WinWait("cView - InstallShield Wizard")
ControlClick($sTitle,"", "&Next >")
ControlClick($sTitle,"", "[CLASS:Button;INSTANCE:3]")
ControlClick($sTitle,"", "&Next >")
ControlClick($sTitle,"", "&Next >")
ControlClick($sTitle,"", "&Next >")
ControlClick($sTitle,"", "&Next >")
ControlClick($sTitle,"", "&Install")
ControlClick($sTitle,"", "&Finish")

It will go through the entire install just fine, however for the last 'ControlClick' it will not send the Finish. I tried 'WinWait', but I found that will mess my code up in a various places for some reason.

It might be that the control has a unique handle....... Use the "AutoIt window info" tool to get the handle of the control.

EDIT:

Also, check the helpfile for AutoItSetOption("WinTitleMatchMode", 2)

You can copy that into AutoIt, drop your cursor into the method and press F1 to get the info.

Edited by Colyn1337
Link to comment
Share on other sites

It might be that the control has a unique handle....... Use the "AutoIt window info" tool to get the handle of the control.

EDIT:

Also, check the helpfile for AutoItSetOption("WinTitleMatchMode", 2)

You can copy that into AutoIt, drop your cursor into the method and press F1 to get the info.

This is what I got, haven't messed with handles yet so not sure exactly where to start.

>>>> Window <<<<

Title: cView - InstallShield Wizard

Class: MsiDialogCloseClass

Position: 388, 301

Size: 504, 382

Style: 0x14C80000

ExStyle: 0x00040100

Handle: 0x00000000003509AE

>>>> Control <<<<

Class: Button

Instance: 1

ClassnameNN: Button1

Name:

Advanced (Class): [CLASS:Button; INSTANCE:1]

ID: 8569

Text: &Finish

Position: 306, 324

Size: 88, 22

ControlClick Coords: 38, 9

Style: 0x50032001

ExStyle: 0x00000000

Handle: 0x0000000000010F42

>>>> Mouse <<<<

Position: 735, 659

Cursor ID: 2

Color: 0x32368E

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<

&Finish

Cancel

NewBinary5

< &Back

The InstallShield Wizard has successfully installed cView. Click Finish to exit the wizard.

InstallShield Wizard Completed

>>>> Hidden Text <<<<

CheckBox1

&Yes, check for program updates (Recommended) after the setup completes.

Launch the program

Show the readme file

The InstallShield Wizard has successfully uninstalled cView. Click Finish to exit the wizard.

Setup has finished installing cView.

Some program files might have been updated since you purchased your copy of cView.

Your Internet connection can be used to make sure that you have the latest updates.

Link to comment
Share on other sites

Have you been successfull trying the silent install?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

from memory the .iss file is created in system32 or windows folder somewhere like that

There is documentation on the installshield stuff around the web

http://publib.boulder.ibm.com/tividd/td/framework/GC32-0804-00/en_US/HTML/instgu25.htm

If no location is specified by the -f1 option, a setup.iss file is written to the %SystemRoot%windir directory for Windows operating systems. For example on Windows NT, the directory might be c:winnt; for Windows 98, it might be c:windows.

Link to comment
Share on other sites

Try putting a winwaitactive before each controlclick.

If your script doesnt finish, but autoitsetoption("trayicondebug",true) near the top of your script.

Tried that, but still same result.

Have you been successfull trying the silent install?

I was really looking to figure out this software so I could use it more efficiently and not just be one of them people who just doesn't understand it.

from memory the .iss file is created in system32 or windows folder somewhere like that

There is documentation on the installshield stuff around the web

http://publib.boulder.ibm.com/tividd/td/framework/GC32-0804-00/en_US/HTML/instgu25.htm

If no location is specified by the -f1 option, a setup.iss file is written to the %SystemRoot%\windir directory for Windows operating systems. For example on Windows NT, the directory might be c:\winnt; for Windows 98, it might be c:\windows.

I did not try the -f1 option to find it. I did look through my windows folder though since that was where all the tutorials said it would be. I'll check those other locations though.

Link to comment
Share on other sites

Not a good idea. The script recorder is based on screen coordinates to click on buttons etc. If the screen resolution or the window position changes the script might act different or will not work at all.

I suggest to try

1) Silent install

2) Having the scritp work with windows and controls

3) Adding a lot of error checking to 2)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

Why not use the script recorder and go through the install using the keyboard just a thought.

I tried the mouse, but actually didn't even think to try just the keyboard. I haven't touched the code since yesterday morning as I have been busy with a few things at my work. I'll give it a try in a few though.

Link to comment
Share on other sites

@water

That's why I suggested using the keyboard to send TABs and Enter on active windows not cords of mouse clicks. I think it is also best to use the silent install if it is available but unless the software supports silent switches then you have to make your own. Hope it works Eric.

Link to comment
Share on other sites

@water

That's why I suggested using the keyboard to send TABs and Enter on active windows not cords of mouse clicks. I think it is also best to use the silent install if it is available but unless the software supports silent switches then you have to make your own. Hope it works Eric.

Thanks, yeah I'll post up the code once I get it all sorted out.

Link to comment
Share on other sites

Okay guys, last thing. It trips me up, I have this code now.

Run('\\installs1\Public\cView\cv11-rc.exe')
$sTitle="cView - InstallShield Wizard"
WinWait("cView - InstallShield Wizard")
ControlClick($sTitle,"", "&Next >")
ControlClick($sTitle,"", "[CLASS:Button;INSTANCE:3]")
ControlClick($sTitle,"", "&Next >")
ControlClick($sTitle,"", "&Next >")
ControlClick($sTitle,"", "&Next >")
ControlClick($sTitle,"", "&Next >")
ControlClick($sTitle,"", "&Install")
ControlClick($sTitle,"", "&Finish")

It will go through the entire install just fine, however for the last 'ControlClick' it will not send the Finish. I tried 'WinWait', but I found that will mess my code up in a various places for some reason.

Eric,

In that script example I linked you to I used a Do/Until loop. It was necessary to make the script pause until the Finish button was available. You may want to try that as well.

Do
$Finish = ControlGetHandle("PetraPro Setup", "Finish", 1)
Sleep(100)
Until $Finish <> ""
ControlClick("PetraPro Setup", "Finish", 1)
Link to comment
Share on other sites

Eric,

In that script example I linked you to I used a Do/Until loop. It was necessary to make the script pause until the Finish button was available. You may want to try that as well.

Do
$Finish = ControlGetHandle("PetraPro Setup", "Finish", 1)
Sleep(100)
Until $Finish <> ""
ControlClick("PetraPro Setup", "Finish", 1)

I looked over that, I'll try that when I get a chance.
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...