Sign in to follow this  
Followers 0
PCJEEPER

Installer Help

6 posts in this topic

Hello, I am new to install scripts, so bare with me please...

I have been reading some posts about scripted installations, and then some about unattended installations, and found some code and was playing around with it, and got it to work for the most part. except i could only get i program to install, i had to make an individual script for each program, when i tried to put them in line they would all open at the same time, and lock up my pc.

I work for a school corp. and we periodically need to do updates on workstations, my overall goal is to make 1 large installer that can be launch from a pen drive or network location that will install a number of programs (exe files and a few MSI files) as an unattended installation.

Sample install would be...

Adobe Reader

Adobe Shockwave

Adobe Flash IE

Adobe Flash Firefox

CCleaner

Mozilla Firefox

Smart Board Updates (exe installer)

Groupwise 8

VLC Media Player

Etc...

All unattended

And for grins and giggles I would like there to be an interface that allows you to install individual ones, or and option to install all, and maybe even in the future be able to install printers and set duplex option on them if possible, and maybe a progress bar with an installation complete notification, and reboot now/later prompt.

I just do not know enough yet to compile all of this into one single installer...

Thanks

Share this post


Link to post
Share on other sites



I also do installations for workstations where I work.

The way I did mine is that I still made the individual installer scripts for each program in my installers library, mostly because I'm not aware whether any of them have unattended installations or commandline parameters. I didn't bother looking them up.

Anyway, after making a pile of installation scripts, all I did was make a program loader script that launched each script in succession while making sure that only one script is active at any one time (_Singleton helps, so does ProcessWaitClose). After that, I also made a GUI based launcher that lists checkboxes for each of my installations scripts so I can choose which will run.

The only thing I lack is the capacity to alter the execution order of my scripts during selection, without altering my ini settings and reloading my launcher script.

Here's the code I used for my launcher:

#include <Misc.au3>
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <TreeViewConstants.au3>
_Singleton("Automated Launcher Script")
Opt("MustDeclareVars", 1)
Opt("GUIOnEventMode", 1)
HotKeySet("^!x", "_Close");Exit on Ctrl+Alt+X

Global $ininame = "_process_launcher.ini"

If $CmdLine[0] == 1 Then
    $ininame = $CmdLine[1]
EndIf

If Not FileExists($ininame) Then
    MsgBox(0x2030, "Error", "No """ & $ininame & """! Writing empty .ini file.")
    _CreateINI()
    Exit
EndIf

Global $slist = IniReadSectionNames($ininame)
If @error == 1 Then
    MsgBox(0x2030, "Error", "Read fail for " & $ininame & "! File empty or invalid.")
    Exit
EndIf
Global $guiWindow = GUICreate("Process Queue", 250, 250)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Close")
Global $guiButton = GUICtrlCreateButton("OK", 85, 210, 80, 30, $BS_DEFPUSHBUTTON)
GUICtrlSetOnEvent($guiButton, "_ButtonEvent")
Global $guiLabel = GUICtrlCreateLabel("Choose programs to Install:", 10, 10, 180, 15)
Global $guiTree = GUICtrlCreateTreeView(10, 30, 230, 175, $TVS_CHECKBOXES)
Global $tItem[$slist[0] + 1]
For $i = 1 To $slist[0]
    $tItem[$i] = GUICtrlCreateTreeViewItem($slist[$i], $guiTree)
Next
GUISetState(@SW_SHOW)

Sleep(86400000)

Func _ButtonEvent()
    Local $msgres = MsgBox(0x2124, "Confirm Selection", "Are you sure of your selection?", 86400, $guiWindow)
    If $msgres == 6 Then
        GUISetState(@SW_HIDE)
        Local $pID, $path, $dir, $checked = False
        For $i = 1 To $slist[0]
            If BitAND(GUICtrlRead($tItem[$i]), $GUI_CHECKED) Then
                $checked = True
                $path = IniRead($ininame, $slist[$i], "path", "<no path>")
                $dir = IniRead($ininame, $slist[$i], "dir", ".\")
                $pID = Run($path, $dir, @SW_HIDE)
                If @error <> 0 Then
                    MsgBox(0x2030, "Error", "Failed to run " & $slist[$i] & ": """ & $path & """!", 86400, $guiWindow)
                EndIf
                ProcessWaitClose($pID)
            EndIf
        Next
        GUISetState(@SW_SHOW)
        If $checked Then
            MsgBox(0x2000, "Process Launcher", "Process queue finished!", 86400, $guiWindow)
            _Close()
        Else
            MsgBox(0x2000, "Process Launcher", "No process selected!", 86400, $guiWindow)
        EndIf
    EndIf
EndFunc

Func _CreateINI()
    Local $file = FileOpen($ininame, 2)
    FileWriteLine($file, ";INI file for Process Launcher")
    FileWriteLine($file, ";")
    FileWriteLine($file, ";INI file format is:")
    FileWriteLine($file, ";[SECTION]")
    FileWriteLine($file, ";KEY = VALUE")
    FileWriteLine($file, ";")
    FileWriteLine($file, ";Section name is label for installation script.")
    FileWriteLine($file, ";Key(s) are: Path, Dir")
    FileWriteLine($file, ";")
    FileWriteLine($file, ";Processes are launched in succeeding order, one at a time.")
    FileWriteLine($file, ";")
    FileWriteLine($file, ";Sample:")
    FileWriteLine($file, ";[Installer Label 1]")
    FileWriteLine($file, ";path = someprogram.exe")
    FileWriteLine($file, ";[Installer Label 2]")
    FileWriteLine($file, ";path = .\path\someprogram.exe")
    FileWriteLine($file, ";[Installer Label 3]")
    FileWriteLine($file, ";path = D:\path\someprogram.exe")
    FileWriteLine($file, ";dir = D:\path")
    FileWriteLine($file, ";")
    FileWriteLine($file, ";Start entries here:")
    FileClose($file)
EndFunc

Func _Close()
    Exit
EndFunc

Share this post


Link to post
Share on other sites

Question...

What information should the _process_launch.ini contain?

Also do I need these files? If so where can i find them, or how do i create them

#include <Misc.au3>

#include <GUIConstantsEx.au3>

#include <ButtonConstants.au3>

#include <TreeViewConstants.au3>

Sorry for the dumb questions....

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

The #include(s) are packaged with AutoIt by default, so you don't need to find them. They are needed in the code to tell the compiler to include those files for compilation.

If you compile the script and run it,it will automatically generate the ini file with information regarding its use. Or you can just look at all the FileWriteLine(s) near the end of the script.

I forgot to add that the "Dir" key is for the working directory. That information is not mentioned in the ini file.

Edited by omikron48

Share this post


Link to post
Share on other sites

Question...

What information should the _process_launch.ini contain?

Also do I need these files? If so where can i find them, or how do i create them

#include <Misc.au3>

#include <GUIConstantsEx.au3>

#include <ButtonConstants.au3>

#include <TreeViewConstants.au3>

Sorry for the dumb questions....

It's in the help file.

Share this post


Link to post
Share on other sites

No, it's not in the help file because I'm the one who made the script.

You may find information about the au3 files listed but I don't think it would be anything useful for the intended purpose.

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
Sign in to follow this  
Followers 0