Sign in to follow this  
Followers 0
tjestr

Tabbed GUI

6 posts in this topic

Hello,

i'm trying to write a gui based unattended installation for our citrix farm servers. so here is my problem:

i want to seperate the groups "navision" "office" and "tools" in different tabs in the gui. but my problem is that all created item will be created in the "navision" tab. any idea on how to this?

#include <GUIConstants.au3>
#include <InstallFuncs.au3>

Global $oDictionary, $oMyError
Global $vKey, $sItem

$oDictionary = _InitDictionary()
$oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")

; ------------- Applications & Filepaths -------------------------------

;Navision
_AddItem("Navision 3.56A", "M:\Programme\Navision\Navi356a\fin.exe")         ;[0]
_AddItem("Navision 2.01B", "M:\Programme\Navision\Navi201b\fin.exe")         ;[1]
_AddItem("Navision 2.60F", "M:\Programme\Navision\Navi260f\fin.exe")         ;[2]
_AddItem("Navision 3.10A", "M:\Programme\Navision\Navi310a\fin.exe")         ;[3]
_AddItem("Navision 3.60", "M:\Programme\Navision\Navi360\fin.exe")           ;[4]  
_AddItem("Navision 3.70B", "M:\Programme\Navision\Navi370b\fin.exe")         ;[5]
_AddItem("Navision 3.70", "M:\Programme\Navision\Navi370\fin.exe")           ;[6]
_AddItem("Navision 3.70 HF13", "M:\Programme\Navision\Navi370hf12\fin.exe")  ;[7]
_AddItem("Navision 4.00 SP3", "M:\Programme\Navision\Navi40sp3\fin.exe")     ;[8]
_AddItem("Navision 4.00", "M:\Programme\Navision\Navi40\fin.exe")            ;[9]
_AddItem("Navision 4.00 SP1", "M:\Programme\Navision\Navi40sp1\fin.exe")     ;[10]
_AddItem("Navision 4.00 SP2", "M:\Programme\Navision\Navi40sp2\fin.exe")     ;[11]
_AddItem("Navision 5.00", "M:\Programme\Navision\Navi50\fin.exe")            ;[12]
_AddItem("CCAPS", "M:\Programme\Navision\CCAPS\CCAPSN.EXE")                  ;[13]
_AddItem("Fließtexteditor", "M:\Programme\Navision\TextFin 1.3\TextFIN.dll") ;[14]
_AddItem("Navision Lizenzen", "M:\Programme\Navision\Navi370b\fin.flf")      ;[15]

;Office
_AddItem("Microsoft Office 2007", "M:\Programme\Microsoft Office\Office12\Outlook.exe")     ;[16]
_AddItem("Microsoft Visio 2003", "M:\Programme\Microsoft Office\Visio11\Visio.exe")         ;[17]
_AddItem("Microsoft Project 2003", "M:\Programme\Microsoft Office\OFFICE11\WINPROJ.EXE")    ;[18]
_AddItem("Microsoft MapPoint 2006", "M:\Programme\Microsoft MapPoint Europe\MapPoint.exe")  ;[19]
_AddItem("Microsoft JetReports 5", "M:\Programme\JetReports\JetReports.xla")                ;[20]

;Tools
_AddItem("7Zip 4.42", "M:\Programme\7-Zip\7zFM.exe")                                                        ;[21]
_AddItem("Adobe Reader 8.1", "M:\Programme\Adobe\Reader 8.1\Reader\AcroRd32.exe")                           ;[22]
_AddItem("Adobe Flash Player 9.0", "M:\WINDOWS\system32\Macromed\Flash\flashplayer.xpt")                    ;[23]
_AddItem("LS Retail Toolbox 4.32", "M:\Programme\LS Retail\Toolbox\LSTools.ocx")                            ;[24]
_AddItem("Saperion Client", "M:\Programme\Saperion\archie32.exe")                                           ;[25]
_AddItem("SharpDevelop 2.2.1", "M:\Programme\SharpDevelop\2.2\bin\SharpDevelop.exe")                        ;[26]
_AddItem("PDF Machine 9.5", "M:\Programme\PDF Machine\bgsview.exe")                                         ;[27]
_AddItem("BGInfo 4.10", "M:\BGInfoCTX\Bginfo.exe")                                                          ;[28]
_AddItem("CABUS Desktop", "M:\Programme\DCM\Dresdner CashManagement 3.01.lnk")                              ;[29]
_AddItem("Kaspersky AntiVirus 6.0", "M:\Programme\KAV\Kaspersky Anti-Virus 6.0 for Windows Servers\avp.exe");[30]


; ------------- Creating the GUI ----------------------------------------

GUICreate("Citrix Farm", 300, 450)
GUICtrlCreateTab(10,10,280,430)
GUICtrlCreateTabitem ("Navision")

$items = _ItemCount()

Dim $appchkbox[$items], $top = 40, $i = 0

For $vKey In $oDictionary
    $appchkbox[$i] = GUICtrlCreateCheckbox($vKey, 20, $top)
    If FileExists(_Item($vKey)) Then
        GUICtrlSetState($appchkbox[$i], $GUI_DISABLE)
    Else
        GUICtrlSetState($appchkbox[$i], $GUI_UNCHECKED)
    EndIf
    $top += 20
    $i += 1
Next

GUICtrlCreateTabitem ("")
GUICtrlCreateTabitem ("Office")
GUICtrlCreateTabitem ("")
GUICtrlCreateTabitem ("Tools")
GUICtrlCreateTabitem ("")

$b_selectall = GUICtrlCreateButton("Select all", 20, 370, 80)
$b_deselectall = GUICtrlCreateButton("Deselect all", 100, 370, 80)
$b_install = GUICtrlCreateButton("Install", 20, 400, 80)
$b_exit = GUICtrlCreateButton("Exit", 100, 400, 80)

GUISetState()

; ------------- GUI Actions  --------------------------------------------

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $b_install
            Call install ()
        Case $b_exit
            Exit
        Case $b_deselectall
            For $i = 0 To $items - 1
                GUICtrlSetState($appchkbox[$i], $GUI_UNCHECKED)
            Next
        Case $b_selectall
            For $i = 0 To $items - 1
                If GUICtrlGetState($appchkbox[$i]) <> 144 Then GUICtrlSetState($appchkbox[$i], $GUI_CHECKED)
            Next
    EndSwitch
WEnd

; ------------- Creating GUI Items & Check if App already installed  -----

$oDictionary.RemoveAll ()
MsgBox(0x0, 'Items Count', _ItemCount(), 3)

Func _InitDictionary()
    Return ObjCreate("Scripting.Dictionary")
EndFunc 

Func _AddItem($v_key, $v_item)
    $oDictionary.ADD ($v_key, $v_item)
    If @error Then Return SetError(1, 1, -1)
EndFunc 

Func _ItemExists($v_key)
    Return $oDictionary.Exists ($v_key)
EndFunc 

Func _Item($v_key)
    Return $oDictionary.Item ($v_key)
EndFunc 

Func _ChangeItem($v_key, $v_item)
    $oDictionary.Item ($v_key) = $v_item
EndFunc 

Func _ChangeKey($v_key, $v_newKey)
    $oDictionary.Key ($v_key) = $v_newKey
EndFunc  

Func _ItemRemove($v_key)
    $oDictionary.Remove ($v_key)
    If @error Then Return SetError(1, 1, -1)
EndFunc 

Func _ItemCount()
    Return $oDictionary.Count
EndFunc  

Func _GetItems()
    Return $oDictionary.Items
EndFunc 

; ------------- Installation --------------------------------------------

Func install()
    
    ;Navision
    If Guictrlread($appchkbox[0]) = $GUI_CHECKED Then si_356a ()
    If Guictrlread($appchkbox[1]) = $GUI_CHECKED Then si_201b ()
    If Guictrlread($appchkbox[2]) = $GUI_CHECKED Then si_260f ()
    If Guictrlread($appchkbox[3]) = $GUI_CHECKED Then si_310a ()
    If Guictrlread($appchkbox[4]) = $GUI_CHECKED Then si_360 ()
    If Guictrlread($appchkbox[5]) = $GUI_CHECKED Then si_370b ()
    If Guictrlread($appchkbox[6]) = $GUI_CHECKED Then si_370 ()
    If Guictrlread($appchkbox[7]) = $GUI_CHECKED Then si_370hf13 ()
    If Guictrlread($appchkbox[8]) = $GUI_CHECKED Then si_400sp3 ()
    If Guictrlread($appchkbox[9]) = $GUI_CHECKED Then si_400 ()
    If Guictrlread($appchkbox[10]) = $GUI_CHECKED Then si_400sp1 ()
    If Guictrlread($appchkbox[11]) = $GUI_CHECKED Then si_400sp2 ()
    If Guictrlread($appchkbox[12]) = $GUI_CHECKED Then si_500 ()
    If Guictrlread($appchkbox[13]) = $GUI_CHECKED Then si_ccaps ()
    If Guictrlread($appchkbox[14]) = $GUI_CHECKED Then si_fte ()
    If Guictrlread($appchkbox[15]) = $GUI_CHECKED Then si_navlic ()

    ;Office
    If Guictrlread($appchkbox[16]) = $GUI_CHECKED Then si_office ()
    If Guictrlread($appchkbox[17]) = $GUI_CHECKED Then si_visio ()
    If Guictrlread($appchkbox[18]) = $GUI_CHECKED Then si_project ()
    If Guictrlread($appchkbox[19]) = $GUI_CHECKED Then si_mappoint ()
    If Guictrlread($appchkbox[20]) = $GUI_CHECKED Then si_jetreports ()

    ;Tools
    If Guictrlread($appchkbox[21]) = $GUI_CHECKED Then si_7zip ()
    If Guictrlread($appchkbox[22]) = $GUI_CHECKED Then si_adobereader ()
    If Guictrlread($appchkbox[23]) = $GUI_CHECKED Then si_adobeflashplayer ()
    If Guictrlread($appchkbox[24]) = $GUI_CHECKED Then si_lsretailtoolbox ()
    If Guictrlread($appchkbox[25]) = $GUI_CHECKED Then si_saperionclient ()
    If Guictrlread($appchkbox[26]) = $GUI_CHECKED Then si_sharpdevelop ()
    If Guictrlread($appchkbox[27]) = $GUI_CHECKED Then si_pdfmachine ()
    If Guictrlread($appchkbox[28]) = $GUI_CHECKED Then si_bginfo ()
    If Guictrlread($appchkbox[29]) = $GUI_CHECKED Then si_cabusdesktop ()
    If Guictrlread($appchkbox[30]) = $GUI_CHECKED Then si_kaspersky ()
    
EndFunc

; ------------- Error handling ------------------------------------------

Func MyErrFunc()
    Local $err = $oMyError.number
    If $err = 0 Then $err = -1
    SetError($err) 
EndFunc 

Func _DebugPrint($s_Text)
    ConsoleWrite( _
            "!===========================================================" & @LF & _
            "+===========================================================" & @LF & _
            "-->" & $s_Text & @LF & _
            "+===========================================================" & @LF)
EndFunc

Share this post


Link to post
Share on other sites



Hello,

i'm trying to write a gui based unattended installation for our citrix farm servers. so here is my problem:

i want to seperate the groups "navision" "office" and "tools" in different tabs in the gui. but my problem is that all created item will be created in the "navision" tab. any idea on how to this?

#include <GUIConstants.au3>
#include <InstallFuncs.au3>

Global $oDictionary, $oMyError
Global $vKey, $sItem

$oDictionary = _InitDictionary()
$oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")

; ------------- Applications & Filepaths -------------------------------

;Navision
_AddItem("Navision 3.56A", "M:\Programme\Navision\Navi356a\fin.exe")         ;[0]
_AddItem("Navision 2.01B", "M:\Programme\Navision\Navi201b\fin.exe")         ;[1]
_AddItem("Navision 2.60F", "M:\Programme\Navision\Navi260f\fin.exe")         ;[2]
_AddItem("Navision 3.10A", "M:\Programme\Navision\Navi310a\fin.exe")         ;[3]
_AddItem("Navision 3.60", "M:\Programme\Navision\Navi360\fin.exe")           ;[4]  
_AddItem("Navision 3.70B", "M:\Programme\Navision\Navi370b\fin.exe")         ;[5]
_AddItem("Navision 3.70", "M:\Programme\Navision\Navi370\fin.exe")           ;[6]
_AddItem("Navision 3.70 HF13", "M:\Programme\Navision\Navi370hf12\fin.exe")  ;[7]
_AddItem("Navision 4.00 SP3", "M:\Programme\Navision\Navi40sp3\fin.exe")     ;[8]
_AddItem("Navision 4.00", "M:\Programme\Navision\Navi40\fin.exe")            ;[9]
_AddItem("Navision 4.00 SP1", "M:\Programme\Navision\Navi40sp1\fin.exe")     ;[10]
_AddItem("Navision 4.00 SP2", "M:\Programme\Navision\Navi40sp2\fin.exe")     ;[11]
_AddItem("Navision 5.00", "M:\Programme\Navision\Navi50\fin.exe")            ;[12]
_AddItem("CCAPS", "M:\Programme\Navision\CCAPS\CCAPSN.EXE")                  ;[13]
_AddItem("Fließtexteditor", "M:\Programme\Navision\TextFin 1.3\TextFIN.dll") ;[14]
_AddItem("Navision Lizenzen", "M:\Programme\Navision\Navi370b\fin.flf")      ;[15]

;Office
_AddItem("Microsoft Office 2007", "M:\Programme\Microsoft Office\Office12\Outlook.exe")     ;[16]
_AddItem("Microsoft Visio 2003", "M:\Programme\Microsoft Office\Visio11\Visio.exe")         ;[17]
_AddItem("Microsoft Project 2003", "M:\Programme\Microsoft Office\OFFICE11\WINPROJ.EXE")    ;[18]
_AddItem("Microsoft MapPoint 2006", "M:\Programme\Microsoft MapPoint Europe\MapPoint.exe")  ;[19]
_AddItem("Microsoft JetReports 5", "M:\Programme\JetReports\JetReports.xla")                ;[20]

;Tools
_AddItem("7Zip 4.42", "M:\Programme\7-Zip\7zFM.exe")                                                        ;[21]
_AddItem("Adobe Reader 8.1", "M:\Programme\Adobe\Reader 8.1\Reader\AcroRd32.exe")                           ;[22]
_AddItem("Adobe Flash Player 9.0", "M:\WINDOWS\system32\Macromed\Flash\flashplayer.xpt")                    ;[23]
_AddItem("LS Retail Toolbox 4.32", "M:\Programme\LS Retail\Toolbox\LSTools.ocx")                            ;[24]
_AddItem("Saperion Client", "M:\Programme\Saperion\archie32.exe")                                           ;[25]
_AddItem("SharpDevelop 2.2.1", "M:\Programme\SharpDevelop\2.2\bin\SharpDevelop.exe")                        ;[26]
_AddItem("PDF Machine 9.5", "M:\Programme\PDF Machine\bgsview.exe")                                         ;[27]
_AddItem("BGInfo 4.10", "M:\BGInfoCTX\Bginfo.exe")                                                          ;[28]
_AddItem("CABUS Desktop", "M:\Programme\DCM\Dresdner CashManagement 3.01.lnk")                              ;[29]
_AddItem("Kaspersky AntiVirus 6.0", "M:\Programme\KAV\Kaspersky Anti-Virus 6.0 for Windows Servers\avp.exe");[30]
; ------------- Creating the GUI ----------------------------------------

GUICreate("Citrix Farm", 300, 450)
GUICtrlCreateTab(10,10,280,430)
GUICtrlCreateTabitem ("Navision")

$items = _ItemCount()

Dim $appchkbox[$items], $top = 40, $i = 0

For $vKey In $oDictionary
    $appchkbox[$i] = GUICtrlCreateCheckbox($vKey, 20, $top)
    If FileExists(_Item($vKey)) Then
        GUICtrlSetState($appchkbox[$i], $GUI_DISABLE)
    Else
        GUICtrlSetState($appchkbox[$i], $GUI_UNCHECKED)
    EndIf
    $top += 20
    $i += 1
Next

GUICtrlCreateTabitem ("")
GUICtrlCreateTabitem ("Office")
GUICtrlCreateTabitem ("")
GUICtrlCreateTabitem ("Tools")
GUICtrlCreateTabitem ("")

$b_selectall = GUICtrlCreateButton("Select all", 20, 370, 80)
$b_deselectall = GUICtrlCreateButton("Deselect all", 100, 370, 80)
$b_install = GUICtrlCreateButton("Install", 20, 400, 80)
$b_exit = GUICtrlCreateButton("Exit", 100, 400, 80)

GUISetState()

; ------------- GUI Actions  --------------------------------------------

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $b_install
            Call install ()
        Case $b_exit
            Exit
        Case $b_deselectall
            For $i = 0 To $items - 1
                GUICtrlSetState($appchkbox[$i], $GUI_UNCHECKED)
            Next
        Case $b_selectall
            For $i = 0 To $items - 1
                If GUICtrlGetState($appchkbox[$i]) <> 144 Then GUICtrlSetState($appchkbox[$i], $GUI_CHECKED)
            Next
    EndSwitch
WEnd

; ------------- Creating GUI Items & Check if App already installed  -----

$oDictionary.RemoveAll ()
MsgBox(0x0, 'Items Count', _ItemCount(), 3)

Func _InitDictionary()
    Return ObjCreate("Scripting.Dictionary")
EndFunc 

Func _AddItem($v_key, $v_item)
    $oDictionary.ADD ($v_key, $v_item)
    If @error Then Return SetError(1, 1, -1)
EndFunc 

Func _ItemExists($v_key)
    Return $oDictionary.Exists ($v_key)
EndFunc 

Func _Item($v_key)
    Return $oDictionary.Item ($v_key)
EndFunc 

Func _ChangeItem($v_key, $v_item)
    $oDictionary.Item ($v_key) = $v_item
EndFunc 

Func _ChangeKey($v_key, $v_newKey)
    $oDictionary.Key ($v_key) = $v_newKey
EndFunc  

Func _ItemRemove($v_key)
    $oDictionary.Remove ($v_key)
    If @error Then Return SetError(1, 1, -1)
EndFunc 

Func _ItemCount()
    Return $oDictionary.Count
EndFunc  

Func _GetItems()
    Return $oDictionary.Items
EndFunc 

; ------------- Installation --------------------------------------------

Func install()
    
    ;Navision
    If Guictrlread($appchkbox[0]) = $GUI_CHECKED Then si_356a ()
    If Guictrlread($appchkbox[1]) = $GUI_CHECKED Then si_201b ()
    If Guictrlread($appchkbox[2]) = $GUI_CHECKED Then si_260f ()
    If Guictrlread($appchkbox[3]) = $GUI_CHECKED Then si_310a ()
    If Guictrlread($appchkbox[4]) = $GUI_CHECKED Then si_360 ()
    If Guictrlread($appchkbox[5]) = $GUI_CHECKED Then si_370b ()
    If Guictrlread($appchkbox[6]) = $GUI_CHECKED Then si_370 ()
    If Guictrlread($appchkbox[7]) = $GUI_CHECKED Then si_370hf13 ()
    If Guictrlread($appchkbox[8]) = $GUI_CHECKED Then si_400sp3 ()
    If Guictrlread($appchkbox[9]) = $GUI_CHECKED Then si_400 ()
    If Guictrlread($appchkbox[10]) = $GUI_CHECKED Then si_400sp1 ()
    If Guictrlread($appchkbox[11]) = $GUI_CHECKED Then si_400sp2 ()
    If Guictrlread($appchkbox[12]) = $GUI_CHECKED Then si_500 ()
    If Guictrlread($appchkbox[13]) = $GUI_CHECKED Then si_ccaps ()
    If Guictrlread($appchkbox[14]) = $GUI_CHECKED Then si_fte ()
    If Guictrlread($appchkbox[15]) = $GUI_CHECKED Then si_navlic ()

    ;Office
    If Guictrlread($appchkbox[16]) = $GUI_CHECKED Then si_office ()
    If Guictrlread($appchkbox[17]) = $GUI_CHECKED Then si_visio ()
    If Guictrlread($appchkbox[18]) = $GUI_CHECKED Then si_project ()
    If Guictrlread($appchkbox[19]) = $GUI_CHECKED Then si_mappoint ()
    If Guictrlread($appchkbox[20]) = $GUI_CHECKED Then si_jetreports ()

    ;Tools
    If Guictrlread($appchkbox[21]) = $GUI_CHECKED Then si_7zip ()
    If Guictrlread($appchkbox[22]) = $GUI_CHECKED Then si_adobereader ()
    If Guictrlread($appchkbox[23]) = $GUI_CHECKED Then si_adobeflashplayer ()
    If Guictrlread($appchkbox[24]) = $GUI_CHECKED Then si_lsretailtoolbox ()
    If Guictrlread($appchkbox[25]) = $GUI_CHECKED Then si_saperionclient ()
    If Guictrlread($appchkbox[26]) = $GUI_CHECKED Then si_sharpdevelop ()
    If Guictrlread($appchkbox[27]) = $GUI_CHECKED Then si_pdfmachine ()
    If Guictrlread($appchkbox[28]) = $GUI_CHECKED Then si_bginfo ()
    If Guictrlread($appchkbox[29]) = $GUI_CHECKED Then si_cabusdesktop ()
    If Guictrlread($appchkbox[30]) = $GUI_CHECKED Then si_kaspersky ()
    
EndFunc

; ------------- Error handling ------------------------------------------

Func MyErrFunc()
    Local $err = $oMyError.number
    If $err = 0 Then $err = -1
    SetError($err) 
EndFunc 

Func _DebugPrint($s_Text)
    ConsoleWrite( _
            "!===========================================================" & @LF & _
            "+===========================================================" & @LF & _
            "-->" & $s_Text & @LF & _
            "+===========================================================" & @LF)
EndFunc

Haven't tried this but could you do this?

$NCount = 0

For $vKey In $oDictionary
  if $Ncount = 0 then GUICtrlCreateTabitem ("Navision")
  if $NCount v= 16 then GUICtrlCreateTabitem ("Office")
  if $NCount = 21 then GUICtrlCreateTabitem ("Tools")
 
  if $NCount = 0 or $NCount = 16 or $NCount = 21 then
   $top = 40,
   $i = 0
  endif

 $NCount += 1

    $appchkbox[$i] = GUICtrlCreateCheckbox($vKey, 20, $top)
    If FileExists(_Item($vKey)) Then
        GUICtrlSetState($appchkbox[$i], $GUI_DISABLE)
    Else
        GUICtrlSetState($appchkbox[$i], $GUI_UNCHECKED)
    EndIf
    $top += 20
    $i += 1
Next

GUICtrlCreateTabitem ("")

you should only have GUICtrlCreateTabitem ("") once at the end of all the tab items.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

This one works good exept that the select all button does not work anymore? any suggestions?

#include <GUIConstants.au3>
;#include <InstallFuncs.au3>

Global $oDictionary, $oMyError
Global $vKey, $sItem

$oDictionary = _InitDictionary()
$oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")

; ------------- Applications & Filepaths -------------------------------

;Navision
_AddItem("Navision 3.56A", "M:\Programme\Navision\Navi356a\fin.exe")         ;[0]
_AddItem("Navision 2.01B", "M:\Programme\Navision\Navi201b\fin.exe")         ;[1]
_AddItem("Navision 2.60F", "M:\Programme\Navision\Navi260f\fin.exe")         ;[2]
_AddItem("Navision 3.10A", "M:\Programme\Navision\Navi310a\fin.exe")         ;[3]
_AddItem("Navision 3.60", "M:\Programme\Navision\Navi360\fin.exe")           ;[4]  
_AddItem("Navision 3.70B", "M:\Programme\Navision\Navi370b\fin.exe")         ;[5]
_AddItem("Navision 3.70", "M:\Programme\Navision\Navi370\fin.exe")           ;[6]
_AddItem("Navision 3.70 HF13", "M:\Programme\Navision\Navi370hf12\fin.exe")  ;[7]
_AddItem("Navision 4.00 SP3", "M:\Programme\Navision\Navi40sp3\fin.exe")     ;[8]
_AddItem("Navision 4.00", "M:\Programme\Navision\Navi40\fin.exe")            ;[9]
_AddItem("Navision 4.00 SP1", "M:\Programme\Navision\Navi40sp1\fin.exe")     ;[10]
_AddItem("Navision 4.00 SP2", "M:\Programme\Navision\Navi40sp2\fin.exe")     ;[11]
_AddItem("Navision 5.00", "M:\Programme\Navision\Navi50\fin.exe")            ;[12]
_AddItem("CCAPS", "M:\Programme\Navision\CCAPS\CCAPSN.EXE")                  ;[13]
_AddItem("Fließtexteditor", "M:\Programme\Navision\TextFin 1.3\TextFIN.dll") ;[14]
_AddItem("Navision Lizenzen", "M:\Programme\Navision\Navi370b\fin.flf")      ;[15]

;Office
_AddItem("Microsoft Office 2007", "M:\Programme\Microsoft Office\Office12\Outlook.exe")     ;[16]
_AddItem("Microsoft Visio 2003", "M:\Programme\Microsoft Office\Visio11\Visio.exe")         ;[17]
_AddItem("Microsoft Project 2003", "M:\Programme\Microsoft Office\OFFICE11\WINPROJ.EXE")    ;[18]
_AddItem("Microsoft MapPoint 2006", "M:\Programme\Microsoft MapPoint Europe\MapPoint.exe")  ;[19]
_AddItem("Microsoft JetReports 5", "M:\Programme\JetReports\JetReports.xla")                ;[20]

;Tools
_AddItem("7Zip 4.42", "M:\Programme\7-Zip\7zFM.exe")                                                        ;[21]
_AddItem("Adobe Reader 8.1", "M:\Programme\Adobe\Reader 8.1\Reader\AcroRd32.exe")                           ;[22]
_AddItem("Adobe Flash Player 9.0", "M:\WINDOWS\system32\Macromed\Flash\flashplayer.xpt")                    ;[23]
_AddItem("LS Retail Toolbox 4.32", "M:\Programme\LS Retail\Toolbox\LSTools.ocx")                            ;[24]
_AddItem("Saperion Client", "M:\Programme\Saperion\archie32.exe")                                           ;[25]
_AddItem("SharpDevelop 2.2.1", "M:\Programme\SharpDevelop\2.2\bin\SharpDevelop.exe")                        ;[26]
_AddItem("PDF Machine 9.5", "M:\Programme\PDF Machine\bgsview.exe")                                         ;[27]
_AddItem("BGInfo 4.10", "M:\BGInfoCTX\Bginfo.exe")                                                          ;[28]
_AddItem("CABUS Desktop", "M:\Programme\DCM\Dresdner CashManagement 3.01.lnk")                              ;[29]
_AddItem("Kaspersky AntiVirus 6.0", "M:\Programme\KAV\Kaspersky Anti-Virus 6.0 for Windows Servers\avp.exe");[30]


; ------------- Creating the GUI ----------------------------------------

GUICreate("Citrix Farm", 300,450)
GUICtrlCreateTab(10,10,280,360)

$items = _ItemCount()

Dim $appchkbox[$items], $top = 40, $i = 0

$NCount = 0
For $vKey In $oDictionary
  if $Ncount = 0 then GUICtrlCreateTabitem ("Navision")
  if $NCount = 16 then GUICtrlCreateTabitem ("Office")
  if $NCount = 21 then GUICtrlCreateTabitem ("Tools")

  if $NCount = 0 or $NCount = 16 or $NCount = 21 then
   $top = 40
   $i = 0
  endif

$NCount += 1
    $appchkbox[$i] = GUICtrlCreateCheckbox($vKey, 20, $top)
    If FileExists(_Item($vKey)) Then
        GUICtrlSetState($appchkbox[$i], $GUI_DISABLE)
    Else
        GUICtrlSetState($appchkbox[$i], $GUI_UNCHECKED)
    EndIf
    $top += 20
    $i += 1
Next

GUICtrlCreateTabitem ("")

$b_selectall = GUICtrlCreateButton("Select all", 20, 380, 80)
$b_deselectall = GUICtrlCreateButton("Deselect all", 100, 380, 80)
$b_install = GUICtrlCreateButton("Install", 20, 410, 80)
$b_exit = GUICtrlCreateButton("Exit", 100, 410, 80)

GUISetState()

; ------------- GUI Actions  --------------------------------------------

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $b_install
            Call install ()
        Case $b_exit
            Exit
        Case $b_deselectall
            For $i = 0 To $items - 1
                GUICtrlSetState($appchkbox[$i], $GUI_UNCHECKED)
            Next
        Case $b_selectall
            For $i = 0 To $items - 1
                If GUICtrlGetState($appchkbox[$i]) <> 144 Then GUICtrlSetState($appchkbox[$i], $GUI_CHECKED)
            Next
    EndSwitch
WEnd

; ------------- Creating GUI Items & Check if App already installed  -----

$oDictionary.RemoveAll ()
MsgBox(0x0, 'Items Count', _ItemCount(), 3)

Func _InitDictionary()
    Return ObjCreate("Scripting.Dictionary")
EndFunc 

Func _AddItem($v_key, $v_item)
    $oDictionary.ADD ($v_key, $v_item)
    If @error Then Return SetError(1, 1, -1)
EndFunc 

Func _ItemExists($v_key)
    Return $oDictionary.Exists ($v_key)
EndFunc 

Func _Item($v_key)
    Return $oDictionary.Item ($v_key)
EndFunc 

Func _ChangeItem($v_key, $v_item)
    $oDictionary.Item ($v_key) = $v_item
EndFunc 

Func _ChangeKey($v_key, $v_newKey)
    $oDictionary.Key ($v_key) = $v_newKey
EndFunc  

Func _ItemRemove($v_key)
    $oDictionary.Remove ($v_key)
    If @error Then Return SetError(1, 1, -1)
EndFunc 

Func _ItemCount()
    Return $oDictionary.Count
EndFunc  

Func _GetItems()
    Return $oDictionary.Items
EndFunc 

; ------------- Installation --------------------------------------------

Func install()
    
    ;Navision
    If Guictrlread($appchkbox[0]) = $GUI_CHECKED Then si_356a ()
    If Guictrlread($appchkbox[1]) = $GUI_CHECKED Then si_201b ()
    If Guictrlread($appchkbox[2]) = $GUI_CHECKED Then si_260f ()
    If Guictrlread($appchkbox[3]) = $GUI_CHECKED Then si_310a ()
    If Guictrlread($appchkbox[4]) = $GUI_CHECKED Then si_360 ()
    If Guictrlread($appchkbox[5]) = $GUI_CHECKED Then si_370b ()
    If Guictrlread($appchkbox[6]) = $GUI_CHECKED Then si_370 ()
    If Guictrlread($appchkbox[7]) = $GUI_CHECKED Then si_370hf13 ()
    If Guictrlread($appchkbox[8]) = $GUI_CHECKED Then si_400sp3 ()
    If Guictrlread($appchkbox[9]) = $GUI_CHECKED Then si_400 ()
    If Guictrlread($appchkbox[10]) = $GUI_CHECKED Then si_400sp1 ()
    If Guictrlread($appchkbox[11]) = $GUI_CHECKED Then si_400sp2 ()
    If Guictrlread($appchkbox[12]) = $GUI_CHECKED Then si_500 ()
    If Guictrlread($appchkbox[13]) = $GUI_CHECKED Then si_ccaps ()
    If Guictrlread($appchkbox[14]) = $GUI_CHECKED Then si_fte ()
    If Guictrlread($appchkbox[15]) = $GUI_CHECKED Then si_navlic ()

    ;Office
    If Guictrlread($appchkbox[16]) = $GUI_CHECKED Then si_office ()
    If Guictrlread($appchkbox[17]) = $GUI_CHECKED Then si_visio ()
    If Guictrlread($appchkbox[18]) = $GUI_CHECKED Then si_project ()
    If Guictrlread($appchkbox[19]) = $GUI_CHECKED Then si_mappoint ()
    If Guictrlread($appchkbox[20]) = $GUI_CHECKED Then si_jetreports ()

    ;Tools
    If Guictrlread($appchkbox[21]) = $GUI_CHECKED Then si_7zip ()
    If Guictrlread($appchkbox[22]) = $GUI_CHECKED Then si_adobereader ()
    If Guictrlread($appchkbox[23]) = $GUI_CHECKED Then si_adobeflashplayer ()
    If Guictrlread($appchkbox[24]) = $GUI_CHECKED Then si_lsretailtoolbox ()
    If Guictrlread($appchkbox[25]) = $GUI_CHECKED Then si_saperionclient ()
    If Guictrlread($appchkbox[26]) = $GUI_CHECKED Then si_sharpdevelop ()
    If Guictrlread($appchkbox[27]) = $GUI_CHECKED Then si_pdfmachine ()
    If Guictrlread($appchkbox[28]) = $GUI_CHECKED Then si_bginfo ()
    If Guictrlread($appchkbox[29]) = $GUI_CHECKED Then si_cabusdesktop ()
    If Guictrlread($appchkbox[30]) = $GUI_CHECKED Then si_kaspersky ()
    
EndFunc

; ------------- Error handling ------------------------------------------

Func MyErrFunc()
    Local $err = $oMyError.number
    If $err = 0 Then $err = -1
    SetError($err) 
EndFunc 

Func _DebugPrint($s_Text)
    ConsoleWrite( _
            "!===========================================================" & @LF & _
            "+===========================================================" & @LF & _
            "-->" & $s_Text & @LF & _
            "+===========================================================" & @LF)
EndFunc

Share this post


Link to post
Share on other sites

if $NCount = 0 or $NCount = 16 or $NCount = 21 then
   $top = 40
   ;$i = 0
  endif

remove $i = 0

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Thank you very much @ valuater. Now the "check all" buttons works fine.

Does anyone know how to implement a overall progress bar in the status bar?

Or generally how to implement a status bar in the existing window?

plz help

Edited by tjestr

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