Jump to content

Multi-Install


maxblock
 Share

Recommended Posts

Hello,

I'm traying to do a form that will allow me to install several applications one after the other without user intervention.

This is my first script with Autoit and i'm not sure if this is the right way to do it.

Here is what i got so far but is not working because after the initial screen the script pause and do nothing even if i unpause it. See script for comments.

Any help or orientation will be appreciate.

Also I remember using one time a software that allow me to record everything that i do in a computer and after that it can generate a script do do exactly that again. Anyone remember? Or Autoit is the way to do this.

Thanks in advance...

; This script Install a list of applications
#include <GuiConstants.au3>

;Initialize variables
Global $GUIWidth
Global $GUIHeight

$GUIWidth = 800
$GUIHeight = 600

; GUI
GuiCreate("MEGA Install", $GUIWidth, $GUIHeight)
GuiSetIcon(@SystemDir & "\mmc.exe", 0)

; Main
$Label = GuiCtrlCreateLabel("Please select the applications to install.",10,20)
$app1 = GuiCtrlCreateCheckbox("Adobe Acrobat Reader 7.0.5", 10, 40)
GuiCtrlSetState(-1, $GUI_CHECKED)
$app5 = GuiCtrlCreateCheckbox("Office 2000 Professional", 10, 120)
GuiCtrlSetState(-1, $GUI_CHECKED)
$app6 = GuiCtrlCreateCheckbox("WinRAR 3.50 beta 5", 10, 140)
GuiCtrlSetState(-1, $GUI_CHECKED)

;Create an "Install" button
$install = GuiCtrlCreateButton("Install", 10, 330, 100, 30)
;Create a "Cancel" button
$exit = GuiCtrlCreateButton("Exit", 150, 330, 100, 30)

; GUI MESSAGE LOOP
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            GUIDelete()
            Exit
        Case $msg = $install
            if GUICtrlRead($app1) = $GUI_CHECKED Then
            EndIf
            if GUICtrlRead($app5) = $GUI_CHECKED Then
            EndIf
            if GUICtrlRead($app6) = $GUI_CHECKED Then
                Run("\\slfsvr001\Default-Install\Win RAR 35b5.exe")
                WinWaitActive("Open File - Security Warning")
                Send("!r")
                WinWait("WinRAR 3.50 beta 5")
            ;here is where it stop even if that is the correct windows name
                Send("{ENTER}")
                WinWaitActive("WinRAR Setup")
                Send("{ENTER}")
                WinWaitActive("WinRAR Setup","WinRAR has been successfully installed")
                Send("{ENTER}")
                WinWaitActive("WinRAR")
                Send("!f")
                Send("c")
            EndIf       
        Case $msg = $exit
            GUIDelete()
            Exit
    EndSelect
WEnd
Link to comment
Share on other sites

  • Developers

Make sure the Title is exact !

Show the info that AU3Info has on the window it is hanging on so we can see what might be wrong ...

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Make sure the Title is exact !

Show the info that AU3Info has on the window it is hanging on so we can see what might be wrong ...

This is the windows information:

Press CTRL-ALT-F to freeze the display.

>>>>>>>>>>>> Window Details <<<<<<<<<<<<<

Title: WinRAR 3.50 beta 5

Class: #32770

Size: X: 260 Y: 167 W: 503 H: 403

>>>>>>>>>>> Mouse Details <<<<<<<<<<<

Screen: X: 831 Y: 299

Cursor ID: 2

>>>>>>>>>>> Pixel Color Under Mouse <<<<<<<<<<<

RGB: Hex: 0xD8E4F8 Dec: 14214392

>>>>>>>>>>> Control Under Mouse <<<<<<<<<<<

Size:

Control ID:

ClassNameNN:

Text:

>>>>>>>>>>> Status Bar Text <<<<<<<<<<<

>>>>>>>>>>> Visible Window Text <<<<<<<<<<<

TITLE_BMP

Copyright © 1993-2005

by Alexander Roshal

&Destination folder

C:\Program Files\WinRAR

C:\Program Files\WinRAR

Bro&wse...

Install

Cancel

>>>>>>>>>>> Hidden Window Text <<<<<<<<<<<

Link to comment
Share on other sites

WinRAR SFXs use /S for silent install (and the WinRAR installer is a WinRAR SFX). That will save you some automation.

RunWait('"\\slfsvr001\Default-Install\Win RAR 35b5.exe" /S')

;)

You are right about the /S option but still I have to install other apps. that don't have a silent install.

Link to comment
Share on other sites

You are right about the /S option but still I have to install other apps. that don't have a silent install.

I do not know of your other apps but I use Identify Installer in SendToA3X to recognize and inform me of silent switches to use. It may help you recognize, record, create and tidy installation scripts. Installation handling is a major theme of SendToA3X.

Here is a Gui script I just created. I like dynamic so this will search for installation scripts in a directory, list them in the Gui with checkboxes, and install any checked items. The only thing of concern that is hardcoded is the $path to the folder which you can change. I do this concept in other scripts and I also log exitcode of the scripts, AutoIt errors.... so becomes flexible to expand on.

I do not want to confuse you and the option is your own whether to use this idea or not. I did a small test to valid operation.

#include <GUIConstants.au3>
#include <Constants.au3>

; Prepare list
$path = @ScriptDir & '\software'
$list = _GetList($path)
If @error Then
    MsgBox(0x40030, Default, 'Failed to get list of files')
    Exit 1
EndIf

; GUI Create
Global $height = 19 * $list[0]
Global $x = 0
Global $checkbox[$list[0]+1]
$checkbox[0] = $list[0]
GUICreate('Software Install', 300, $height)
For $i = 1 To $list[0]
    $checkbox[$i] = GUICtrlCreateCheckbox($list[$i], 20, $x)
    $x += 18
Next
$button_install = GUICtrlCreateButton('Install', 200, $height - 40, 80)
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $button_install
            For $i = 1 To $list[0]
                If GUICtrlRead($checkbox[$i]) = $GUI_CHECKED Then
                    RunWait('"' & @AutoItExe & '" /AutoIt3ExecuteScript "' & $path & '\' & $list[$i] & '"')
                EndIf
            Next
    EndSwitch
WEnd

Func _GetList($path)
    Local $file_collection, $file_found, $handle_search, $split_items
    $handle_search = FileFindFirstFile($path & '\*.au3')
    If $handle_search <> -1 Then
        While True
            $file_found = FileFindNextFile($handle_search)
            If @error Then ExitLoop
            If StringRight($file_found, 4) = '.au3' Then
                $file_collection &= '|' & $file_found
            EndIf
        WEnd
        FileClose($handle_search)
        $file_collection = StringTrimLeft($file_collection, 1)
        $split_items = StringSplit($file_collection, '|')
        Return $split_items
    Else
        Return SetError(1, 0, '')
    EndIf
EndFunc

Oh, the fault in your WinRAR install is perhaps the WinWait used before the Send. You need an active window so best to WinWait for the window, WinActivate it and then WinWaitActive.

;)

Edited by MHz
Link to comment
Share on other sites

depending on the type of install script the program author used - you can try these

installshield apps - run the setup from start run with a /r on the end - let the program run through and then find the file setup.iss in your windows dir. when you have this file copy it too the folder that your setup is in and then the you can use the setup /s /SMS switch to run a fully silent install

for microsoft MSI apps - use the command msiexec /i setup.exe /qn for a fully silent install

there might be others like the winrar that allows /s and others might take /q

just right click the file and go into the properties to get the maker - also www.appdeploy.com is a good site for silent options etc.

cheers

craig

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