Jump to content

Creating a silent installer


Recommended Posts

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
Link to comment
Share on other sites

  • Moderators

@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?

"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

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.

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Link to comment
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...

Link to comment
Share on other sites

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

"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

Just now, JLogan3o13 said:

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

lol indeed :lol:

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Link to comment
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)?

Link to comment
Share on other sites

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

"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

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?

Link to comment
Share on other sites

  • Moderators

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 

"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

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