Jump to content

Recommended Posts

Posted

Dear all,

I have make a window where you can see what you are installing and how far it is.

Now i'd like to check or uncheck programs what you can install.

And to make my screen larger.

ProgressOn('Installatie van Programmas', 'main', 'sub')
ProgressSet(00, 'Installeren Programma 1 van 5', 'Diskdefrag')
RunWait ("\\brainnas1\software\autoit\installers\diskdefrag.exe" )
Sleep(1000)
ProgressSet(20, 'Installeren Programma 2 van 5', 'Foxit')
RunWait ("\\brainnas1\software\autoit\installers\foxit.exe")
ProgressSet(40, 'Installeren Programma 3 van 5', 'Realvnc 4.1.3')
Sleep(1000)
RunWait ("\\brainnas1\software\autoit\installers\realvnc 4.1.3.exe")
ProgressSet(60, 'Installeren Programma 4 van 5', 'TuneUp')
Sleep(1000)
RunWait ("\\brainnas1\software\autoit\installers\TuneUp.exe")
ProgressSet(80, 'Installeren Programma 5 van 5', 'Malwarebytes')
Sleep(1000)
RunWait ("\\brainnas1\software\autoit\installers\malware.exe")
ProgressSet(100, 'Installeren Compleet', '')
Sleep(1000)
ProgressOff()

naamloos.bmp

I hope you can help my.

Greet,

Aldrinn

  • Moderators
Posted

Aldrinn,

You need to create your own GUI if you want to change the size and use checkboxes. Here is a very basic script to show how you might go about it:

#include <GUIConstantsEx.au3>

; Array to hold paths and names of the apps to install
Global $aApps[5][2] =  [["App1.exe", "App 1"], _
                        ["App2.exe", "App 2"], _
                        ["App3.exe", "App 3"], _
                        ["App4.exe", "App 4"], _
                        ["App5.exe", "App 5"]]

; Array to hold ControlIDs if the checkboxes
Global $aChecks[5]

$hGUI = GUICreate("Test", 500, 500)

; Create the checkboxes
For $i = 0 To 4
    $aChecks[$i] = GUICtrlCreateCheckbox($aApps[$i][1], 10, 10 + (20 * $i), 200, 20)
Next

$hButton = GUICtrlCreateButton("Install", 10, 120, 80, 30)

$hlabel = GUICtrlCreateLabel("", 10, 180, 200, 20)

$hProgress = GUICtrlCreateProgress(10, 200, 480, 20)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hButton
            _Install()
    EndSwitch

WEnd

Func _Install()

    ; See how many apps to install - determines how far progress bar moves each time
    Local $iCount = 0
    For $i = $aChecks[0] To $aChecks[4]
        If GUICtrlRead($i) = 1 Then $iCount += 1
    Next
    If $iCount = 0 Then Return

    ; This will be increased for each app be install
    $iProgress = 0

    ; Run through checkboxes to see which apps to install
    For $i = 0 To 4
        If GUICtrlRead($aChecks[$i]) = 1 Then
            GUICtrlSetData($hlabel, "Installing " & $aApps[$i][1])
            ; Simulate install
            ;RunWait($aApps[$i][0])
            Sleep(5000)
            $iProgress += 100/$iCount
            GUICtrlSetData($hProgress, $iProgress)
        EndIf
    Next

    ; We have finished
    GUICtrlSetData($hlabel, "All installed")

EndFunc

You will see I have used For...Next loops to shorten the code - but this means using arrays to hold the data so it can be accessed in the loops. If you are unsure on arrays, there is a very good tutorial in the Wiki.

Ask if anything is unclear (after you have read the tutorial if it is about arrays!) :mellow:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...