ComBas

Creating a silent installer

13 posts in this topic

#1 ·  Posted (edited)

Hello,

I'm trying to set up a silent installer (and then deploy it to MANY computers in our network...) for an application that doesn't allow to be installed silently on its own.

After a brief study of the basic syntax and a bit of Google-searching, I wrote this script in AutoIt:

AutoItSetOption("TrayIconDebug", 1)

Const $INSTALL_PATH = "\\192.168.10.80\wpkg\sw\gpe\cd\CD vecchia versione"

; Esegue il programma di installazione
Local $ProcID = Run($INSTALL_PATH & "\Setup\setup.exe")
;Local $ProcID = Run($INSTALL_PATH & "\Setup\setup.exe", "", @SW_HIDE)

; Schermata di benvenuto - premi OK
WinWait("Programma di installazione di Gpe versione 2")
ControlClick("Programma di installazione di Gpe versione 2", "", "ThunderRT6CommandButton2")
;WinWaitActive("Programma di installazione di Gpe versione 2")
;Send("{ENTER}")

; Seconda schermata (stesso titolo...) - lascia tutto a default, premi il pulsante principale e avvia l'installazione
WinWait("Programma di installazione di Gpe versione 2")
ControlClick("Programma di installazione di Gpe versione 2", "", "ThunderRT6CommandButton1")
;WinWaitActive("Programma di installazione di Gpe versione 2")
;Send("{ENTER}")

; Terza schermata - mantieni le opzioni predefinite e premi Continua (Alt+C)
WinWait("Gpe versione 2 - Seleziona gruppo di programmi")
ControlClick("Gpe versione 2 - Seleziona gruppo di programmi", "", "ThunderRT6CommandButton2")
;WinWaitActive("Gpe versione 2 - Seleziona gruppo di programmi")
;Send("!c")

; Serie di finestre con conflitti di versione ai file di sistema - Rispondi Sì (Alt+S) a tutte per mantenere i file correnti
;While WinWaitActive("Conflitto di versione", "", 30)
While WinWait("Conflitto di versione", "", 30)
   ;Send("!s")
   ControlClick("Conflitto di versione", "", "ThunderRT6CommandButton3")
WEnd

; Finestra conclusiva - premi OK ed è finita!
WinWait("Programma di installazione di Gpe versione 2")
ControlClick("Programma di installazione di Gpe versione 2", "", "Button1")
;WinWaitActive("Programma di installazione di Gpe versione 2")
;Send("{ENTER}")

; Termina il programma, nel caso non finisse da solo
ProcessClose($ProcID)

It works correctly if the windows are visible, but if change the "Run" line using the @SW_HIDE mode the script gets stuck waiting for the first window.

Am I doing something wrong in the code?

Thanks in advance for answering...

P.S. Sorry for the plain-text formatted code... I tried to use the "Code" button in the forum editor but it doesn't seem to work with Firefox...

Edited by JLogan3o13

Share this post


Link to post
Share on other sites

@ComBas welcome to the forum. You need to put some error checking in your code, to find out just where the script is failing. At the very least, put this at the top of your script, so you can see what line it is hanging on.

Opt("TrayIconDebug", 1)

Also, I attempted to go to the site to download the latest version of CD Vecchia Versione, and was almost overwhelmed by the clickbait and adware. Are you sure this is software you want to be installing on your company machines?


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
11 minutes ago, JLogan3o13 said:

I attempted to go to the site to download the latest version of CD Vecchia Versione

Where did you find the link? My google search did not show up anything particular.


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

Some messages & Apologizes:

If I hurt you, Please accept my apologies, I never (regardless of the situation) mean to hurt anybody!!!

Also, I am very busy with my project so I will appear in the last row of the online list, if you want to contact me: Email@TheDcoder.xyz

Or you can have a nice chat with me in freenode, I use the same nick on freenode too!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites
9 minutes ago, JLogan3o13 said:

@ComBas welcome to the forum. You need to put some error checking in your code, to find out just where the script is failing. At the very least, put this at the top of your script, so you can see what line it is hanging on.

Opt("TrayIconDebug", 1)

 

Done (I already used the "extended" version AutoItSetOption...). It hangs on this line:

20 minutes ago, ComBas said:

WinWait("Programma di installazione di Gpe versione 2")

10 minutes ago, JLogan3o13 said:

Also, I attempted to go to the site to download the latest version of CD Vecchia Versione, and was almost overwhelmed by the clickbait and adware. Are you sure this is software you want to be installing on your company machines?

'^_^ The software is actually called GPE, it has been developed by an Italian government agency to help Municipalities manage all the "building works bureaucracy"... "CD vecchia versione" is just the Italian for "old version in CD" or similar...

Share this post


Link to post
Share on other sites

Old Version CD I think... He might be trying to install to the "Old Version CD" folder :D.


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

Some messages & Apologizes:

If I hurt you, Please accept my apologies, I never (regardless of the situation) mean to hurt anybody!!!

Also, I am very busy with my project so I will appear in the last row of the online list, if you want to contact me: Email@TheDcoder.xyz

Or you can have a nice chat with me in freenode, I use the same nick on freenode too!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites
1 hour ago, ComBas said:

Done (I already used the "extended" version AutoItSetOption...). It hangs on this line:

'^_^ The software is actually called GPE, it has been developed by an Italian government agency to help Municipalities manage all the "building works bureaucracy"... "CD vecchia versione" is just the Italian for "old version in CD" or similar...

Interesting @ComBas, there is actually software called CD vecchia versione I found through a Google search lol.

As to where you are seeing it hang, it is waiting for that window to pop up and is not seeing it. Maybe try adding some text from the window into the second WinWait parameter.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
Just now, JLogan3o13 said:

there is actually software called CD vecchia versione I found through a Google search lol.

lol indeed :lol:


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

Some messages & Apologizes:

If I hurt you, Please accept my apologies, I never (regardless of the situation) mean to hurt anybody!!!

Also, I am very busy with my project so I will appear in the last row of the online list, if you want to contact me: Email@TheDcoder.xyz

Or you can have a nice chat with me in freenode, I use the same nick on freenode too!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites
13 hours ago, JLogan3o13 said:

As to where you are seeing it hang, it is waiting for that window to pop up and is not seeing it. Maybe try adding some text from the window into the second WinWait parameter.

I could try... but why the windows are correctly caught when they are visible (i.e. the "Run" function has no parameter @SW_HIDE), and they are not when the script is started in hidden mode (parameter @SW_HIDE is present)?

Share this post


Link to post
Share on other sites

You need to work around with switches. See if your application supports silent switches. Most setup packaging applications do.

Here's an application that I used to model my silent installer.

Share this post


Link to post
Share on other sites
21 hours ago, ComBas said:

for an application that doesn't allow to be installed silently on its own.

@pranaynanda the very first thing the OP stated...


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
16 hours ago, JLogan3o13 said:

the very first thing the OP stated...

My mistake. Didn't read carefully enough.

Share this post


Link to post
Share on other sites
On 17/6/2016 at 8:50 AM, pranaynanda said:

You need to work around with switches. See if your application supports silent switches. Most setup packaging applications do.

 

As mentioned before, I couldn't find a switch to get the silent installation: I tried various ones like /?, /h, -h, --help to find information, but none of then worked.

Also, you can notice a while loop in the code: that code answers to a series of windows that ask confirmation for replacing system components in C:\Windows\System32 with much older versions (yes, I'm blaming everyday with the developers about this. They also inserted a "Replace all" button but not a "Keep all" one...). What if an hypotetical silent installer would rewrite them without my consent?

Share this post


Link to post
Share on other sites

If it is changing system components, and depending of course on the number of machines you're pushing this out to, I would look to invest the time to create an MSI that can be deployed silently. You could use one of the open source tools such as Wix 


√-1 2^3 ∑ π, and it was delicious!

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