Sign in to follow this  
Followers 0
Pook

Reading an INI (Install script)

6 posts in this topic

Can someone point out what I'm doing wrong. I'm making a script (GUI) to install software that people at work check. The script checks the box and if it's box is checked the script goes and looks at the ini file on what to install... (if that makes any sense)

Reading the INI

$Installs_R[1] = IniRead($Install_INI, "App1", "Run_Key", "1")
$Installs_R[2] = IniRead($Install_INI, "App2", "Run_Key", "1")
$Installs_R[3] = IniRead($Install_INI, "App3", "Run_Key", "1")
$Installs_R[4] = IniRead($Install_INI, "App4", "Run_Key", "1")
$Installs_R[5] = IniRead($Install_INI, "App5", "Run_Key", "1")
$Installs_R[6] = IniRead($Install_INI, "App6", "Run_Key", "1")
$Installs_R[7] = IniRead($Install_INI, "App7", "Run_Key", "1")
$Installs_R[8] = IniRead($Install_INI, "App8", "Run_Key", "1")
$Installs_R[9] = IniRead($Install_INI, "App9", "Run_Key", "1")
$Installs_R[10] = IniRead($Install_INI, "App10", "Run_Key", "1")

** Up to 100

This is the part that error out. it will run the first checked box fine, but error out on the loop.

for $i = 1 to $APP_CHKBOX[0] & $Installs_R[0]
           If (GUICtrlRead($APP_CHKBOX[$i]) == $GUI_CHECKED) Then 
            if $Installs_R[$i] = "1" then 
            else
             RunWait ($Installs_R[$i])
        endif
             
             else
          endif

          Next

The INI File: (example)

App1]
Name_Key= Micosoft Access 2007
Run_Key= 1 

[App2]
Name_Key= Micosoft Project 2007
Run_Key= 1 

[App3]
Name_Key= Micosoft Viso 2003
Run_Key= C:\--files--\--Test--\Test\Test.cmd

[App4]
Name_Key= Micosoft SoftGid (App-V)
Run_Key= 1

Share this post


Link to post
Share on other sites



Not sure if I can help, but will try. First, you INI you posted the first section [App1] is missing a square bracket: App1] . If that doesn't help, can you post your full code. Those snippets are vague.


[sup]Psibernetic[/sup]My Creations:X-HideSecuracy

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

for $i = 1 to $APP_CHKBOX[0] & $Installs_R[0]
    If (GUICtrlRead($APP_CHKBOX[$i]) == $GUI_CHECKED) Then 
        if $Installs_R[$i] = "1" then 
        else
            RunWait ($Installs_R[$i])
        endif
    else
    endif
Next

Would better be written as:

For $i = 1 To $APP_CHKBOX[0] & $Installs_R[0]
    If (GUICtrlRead($APP_CHKBOX[$i]) == $GUI_CHECKED) Then 
        If StringCompare($Installs_R[$i], "1") <> 0 Then 
            RunWait ($Installs_R[$i])
        EndIf
    EndIf
Next

I'm also pretty sure that:

$APP_CHKBOX[0] & $Installs_R[0]

is wrong. Since the next token to follow 'To' is supposed to be the last count where the For...Next loop is supposed to end.

Just what are you after at placing that expression there?

Edited by omikron48

Share this post


Link to post
Share on other sites

- more info

1)When you open the app (script) the Gui looks at the INI file to load the names of the check boxes.

2) you click on what you want to install and then run the app(script)

** problem: not sure how to get the script to check if the check box is checked, and if it's checked then look up that app in the INI file and run the command to install the software under that app in the INI file.

INI

[Config]
AppName= Beta Install Runner


[App1]
Name_Key= Micosoft Access 2003
Run_Key= 1 (This is where the install command would be)

[App2]
Name_Key= Micosoft Project 2003
Run_Key= 1 

[App3]
Name_Key= Micosoft Viso 2003
Run_Key= C:\--files--\--Test--\Test\install.cmd

[App4]
Name_Key= Micosoft SoftGid
Run_Key= 1


...so on

Full Code: (So not do with the Gui) =)

; ==========================================================================
; 
; 
; NAME: 
; 
; AUTHOR: 
; 
; COMMENT: 
; 
; ==========================================================================
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include "Includes/CompInfo.au3"

Global $strComputer

$Install_INI = ("INI/_Installs.INI")

Dim $APP_CHKBOX[84] ;must change with # of checkboxes
Dim $Installs[84] ;must change with # of checkboxes
Dim $Installs_R[84] ;must change with # of checkboxes (found in Run Function)
$APP_CHKBOX[0] = 83 ;must change with # of checkboxes
$Installs[0] = 83 ;must change with # of checkboxes
$Installs_R[0] =83 ;must change with # of checkboxes (found in Run Function)


#Region Update Labels Menu Information From INI File###
$Application_Name = IniRead($Install_INI, "Config", "AppName", "Any App Installer")
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
; Update Labels Menu Information from INI
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
$Installs[1] = IniRead($Install_INI, "App1", "Name_Key", "Not Found")
$Installs[2] = IniRead($Install_INI, "App2", "Name_Key", "Not Found")
$Installs[3] = IniRead($Install_INI, "App3", "Name_Key", "Not Found")
$Installs[4] = IniRead($Install_INI, "App4", "Name_Key", "Not Found")
$Installs[5] = IniRead($Install_INI, "App5", "Name_Key", "Not Found")
$Installs[6] = IniRead($Install_INI, "App6", "Name_Key", "Not Found")
$Installs[7] = IniRead($Install_INI, "App7", "Name_Key", "Not Found")
$Installs[8] = IniRead($Install_INI, "App8", "Name_Key", "Not Found")
$Installs[9] = IniRead($Install_INI, "App9", "Name_Key", "Not Found")
$Installs[10] = IniRead($Install_INI, "App10", "Name_Key", "Not Found")
$Installs[11] = IniRead($Install_INI, "App11", "Name_Key", "Not Found")
$Installs[12] = IniRead($Install_INI, "App12", "Name_Key", "Not Found")
$Installs[13] = IniRead($Install_INI, "App13", "Name_Key", "Not Found")
$Installs[14] = IniRead($Install_INI, "App14", "Name_Key", "Not Found")
$Installs[15] = IniRead($Install_INI, "App15", "Name_Key", "Not Found")
$Installs[16] = IniRead($Install_INI, "App16", "Name_Key", "Not Found")
$Installs[17] = IniRead($Install_INI, "App17", "Name_Key", "Not Found")
$Installs[18] = IniRead($Install_INI, "App18", "Name_Key", "Not Found")
$Installs[19] = IniRead($Install_INI, "App19", "Name_Key", "Not Found")
$Installs[20] = IniRead($Install_INI, "App20", "Name_Key", "Not Found")
$Installs[21] = IniRead($Install_INI, "App21", "Name_Key", "Not Found")
$Installs[22] = IniRead($Install_INI, "App22", "Name_Key", "Not Found")
$Installs[23] = IniRead($Install_INI, "App23", "Name_Key", "Not Found")
$Installs[24] = IniRead($Install_INI, "App24", "Name_Key", "Not Found")
$Installs[25] = IniRead($Install_INI, "App25", "Name_Key", "Not Found")
$Installs[26] = IniRead($Install_INI, "App26", "Name_Key", "Not Found")
$Installs[27] = IniRead($Install_INI, "App27", "Name_Key", "Not Found")
$Installs[28] = IniRead($Install_INI, "App28", "Name_Key", "Not Found")
$Installs[29] = IniRead($Install_INI, "App29", "Name_Key", "Not Found")
$Installs[30] = IniRead($Install_INI, "App30", "Name_Key", "Not Found")
$Installs[31] = IniRead($Install_INI, "App31", "Name_Key", "Not Found")
$Installs[32] = IniRead($Install_INI, "App32", "Name_Key", "Not Found")
$Installs[33] = IniRead($Install_INI, "App33", "Name_Key", "Not Found")
$Installs[34] = IniRead($Install_INI, "App34", "Name_Key", "Not Found")
$Installs[35] = IniRead($Install_INI, "App35", "Name_Key", "Not Found")
$Installs[36] = IniRead($Install_INI, "App36", "Name_Key", "Not Found")
$Installs[37] = IniRead($Install_INI, "App37", "Name_Key", "Not Found")
$Installs[38] = IniRead($Install_INI, "App38", "Name_Key", "Not Found")
$Installs[39] = IniRead($Install_INI, "App39", "Name_Key", "Not Found")
$Installs[40] = IniRead($Install_INI, "App40", "Name_Key", "Not Found")
$Installs[41] = IniRead($Install_INI, "App41", "Name_Key", "Not Found")
$Installs[42] = IniRead($Install_INI, "App42", "Name_Key", "Not Found")
$Installs[43] = IniRead($Install_INI, "App43", "Name_Key", "Not Found")
$Installs[44] = IniRead($Install_INI, "App44", "Name_Key", "Not Found")
$Installs[45] = IniRead($Install_INI, "App45", "Name_Key", "Not Found")
$Installs[46] = IniRead($Install_INI, "App46", "Name_Key", "Not Found")
$Installs[47] = IniRead($Install_INI, "App47", "Name_Key", "Not Found")
$Installs[48] = IniRead($Install_INI, "App48", "Name_Key", "Not Found")
$Installs[49] = IniRead($Install_INI, "App49", "Name_Key", "Not Found")
$Installs[50] = IniRead($Install_INI, "App50", "Name_Key", "Not Found")
$Installs[51] = IniRead($Install_INI, "App51", "Name_Key", "Not Found")
$Installs[52] = IniRead($Install_INI, "App52", "Name_Key", "Not Found")
$Installs[53] = IniRead($Install_INI, "App53", "Name_Key", "Not Found")
$Installs[54] = IniRead($Install_INI, "App54", "Name_Key", "Not Found")
$Installs[55] = IniRead($Install_INI, "App55", "Name_Key", "Not Found")
$Installs[56] = IniRead($Install_INI, "App56", "Name_Key", "Not Found")
$Installs[57] = IniRead($Install_INI, "App57", "Name_Key", "Not Found")
$Installs[58] = IniRead($Install_INI, "App58", "Name_Key", "Not Found")
$Installs[59] = IniRead($Install_INI, "App59", "Name_Key", "Not Found")
$Installs[60] = IniRead($Install_INI, "App60", "Name_Key", "Not Found")
$Installs[61] = IniRead($Install_INI, "App61", "Name_Key", "Not Found")
$Installs[62] = IniRead($Install_INI, "App62", "Name_Key", "Not Found")
$Installs[63] = IniRead($Install_INI, "App63", "Name_Key", "Not Found")
$Installs[64] = IniRead($Install_INI, "App64", "Name_Key", "Not Found")
$Installs[65] = IniRead($Install_INI, "App65", "Name_Key", "Not Found")
$Installs[66] = IniRead($Install_INI, "App66", "Name_Key", "Not Found")
$Installs[67] = IniRead($Install_INI, "App67", "Name_Key", "Not Found")
$Installs[68] = IniRead($Install_INI, "App68", "Name_Key", "Not Found")
$Installs[69] = IniRead($Install_INI, "App69", "Name_Key", "Not Found")
$Installs[70] = IniRead($Install_INI, "App70", "Name_Key", "Not Found")
$Installs[71] = IniRead($Install_INI, "App71", "Name_Key", "Not Found")
$Installs[72] = IniRead($Install_INI, "App72", "Name_Key", "Not Found")
$Installs[73] = IniRead($Install_INI, "App73", "Name_Key", "Not Found")
$Installs[74] = IniRead($Install_INI, "App74", "Name_Key", "Not Found")
$Installs[75] = IniRead($Install_INI, "App75", "Name_Key", "Not Found")
$Installs[76] = IniRead($Install_INI, "App76", "Name_Key", "Not Found")
$Installs[77] = IniRead($Install_INI, "App77", "Name_Key", "Not Found")
$Installs[78] = IniRead($Install_INI, "App78", "Name_Key", "Not Found")
$Installs[79] = IniRead($Install_INI, "App79", "Name_Key", "Not Found")
$Installs[80] = IniRead($Install_INI, "App80", "Name_Key", "Not Found")
$Installs[81] = IniRead($Install_INI, "App81", "Name_Key", "Not Found")
$Installs[82] = IniRead($Install_INI, "App82", "Name_Key", "Not Found")
$Installs[83] = IniRead($Install_INI, "App83", "Name_Key", "Not Found")
#EndRegion Update Labels Menu Information ###

#Region ### START  GUI section ### 
$Form1 = GUICreate($Application_Name , 1224, 683, 193, 115)
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
$Info_Box = GUICtrlCreateGroup("Device Information", 8, 8, 1201, 121)
$hostname_l = GUICtrlCreateLabel("HostName :", 24, 32, 70, 17)
GUICtrlSetFont(-1, 9, 800, 0, "MS Sans Serif")
$HNL = GUICtrlCreateLabel("Unknown", 100, 32, 70, 17) ;Hostame
    GUICtrlSetColor($HNL,0xff0000)
GUICtrlSetFont(-1, 9, 800, 0, "MS Sans Serif")
$Installdate_l = GUICtrlCreateLabel("Install Date :", 24, 64, 77, 17) ;Install Date
GUICtrlSetFont(-1, 9, 800, 0, "MS Sans Serif")
$IDL = GUICtrlCreateLabel("Unknown", 100, 64, 150, 17)
    GUICtrlSetColor($IDL,0xff0000)
GUICtrlSetFont(-1, 9, 800, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("....... :", 256, 32, 70, 17)
GUICtrlSetFont(-1, 9, 800, 0, "MS Sans Serif")
$Label3 = GUICtrlCreateLabel("....... :", 256, 64, 70, 17)
GUICtrlSetFont(-1, 9, 800, 0, "MS Sans Serif")
$Label4 = GUICtrlCreateLabel("....... :", 520, 32, 70, 17)
GUICtrlSetFont(-1, 9, 800, 0, "MS Sans Serif")
$Label5 = GUICtrlCreateLabel("....... :", 520, 64, 70, 17)
GUICtrlSetFont(-1, 9, 800, 0, "MS Sans Serif")
$Label6 = GUICtrlCreateLabel("....... :", 696, 32, 70, 17)
GUICtrlSetFont(-1, 9, 800, 0, "MS Sans Serif")
$Label7 = GUICtrlCreateLabel("....... :", 696, 64, 70, 17)
GUICtrlSetFont(-1, 9, 800, 0, "MS Sans Serif")
$Label8 = GUICtrlCreateLabel("....... :", 864, 32, 70, 17)
GUICtrlSetFont(-1, 9, 800, 0, "MS Sans Serif")
$Label9 = GUICtrlCreateLabel("....... :", 864, 64, 70, 17)
GUICtrlSetFont(-1, 9, 800, 0, "MS Sans Serif")
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Run_button = GUICtrlCreateButton("Execute", 664, 608, 169, 57, $WS_GROUP)
$exit_button = GUICtrlCreateButton("Cancel", 937, 607, 169, 57, $WS_GROUP)
$Tab1 = GUICtrlCreateTab(8, 136, 1201, 457)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
$Software_install = GUICtrlCreateTabItem("Software Installer")
$Group3 = GUICtrlCreateGroup("tab1-group 1", 24, 176, 289, 417) ;Software Tab Group 1
$APP_CHKBOX[1] = GUICtrlCreateCheckbox($Installs[1],30,200)  ;Checkbox 1
$APP_CHKBOX[2] = GUICtrlCreateCheckbox($Installs[2] ,30,220)  ;Checkbox 2
$APP_CHKBOX[3] = GUICtrlCreateCheckbox($Installs[3] ,30,240)  ;Checkbox 3
$APP_CHKBOX[4] = GUICtrlCreateCheckbox($Installs[4] ,30,260)  ;Checkbox 4
$APP_CHKBOX[5] = GUICtrlCreateCheckbox($Installs[5] ,30,280)  ;Checkbox 5
$APP_CHKBOX[6] = GUICtrlCreateCheckbox($Installs[6] ,30,300)  ;Checkbox 6
$APP_CHKBOX[7] = GUICtrlCreateCheckbox($Installs[7] ,30,320)  ;Checkbox 7
$APP_CHKBOX[8] = GUICtrlCreateCheckbox($Installs[8] ,30,340)  ;Checkbox 8
$APP_CHKBOX[9] = GUICtrlCreateCheckbox($Installs[9] ,30,380)  ;Checkbox 10
$APP_CHKBOX[10] = GUICtrlCreateCheckbox($Installs[10],30,400)  ;Checkbox 11
$APP_CHKBOX[11] = GUICtrlCreateCheckbox($Installs[11] ,30,420)  ;Checkbox 12
$APP_CHKBOX[12] = GUICtrlCreateCheckbox($Installs[12] ,30,440)  ;Checkbox 13
$APP_CHKBOX[13] = GUICtrlCreateCheckbox($Installs[13] ,30,460)  ;Checkbox 14
$APP_CHKBOX[14] = GUICtrlCreateCheckbox($Installs[14] ,30,480)  ;Checkbox 15
$APP_CHKBOX[15] = GUICtrlCreateCheckbox($Installs[15] ,30,500)  ;Checkbox 16
$APP_CHKBOX[16] = GUICtrlCreateCheckbox($Installs[16] ,30,520)  ;Checkbox 17
$APP_CHKBOX[17] = GUICtrlCreateCheckbox($Installs[17] ,30,540)  ;Checkbox 18
$APP_CHKBOX[18] = GUICtrlCreateCheckbox($Installs[18] ,30,560)  ;Checkbox 19
$Group1 = GUICtrlCreateGroup("Software Group 2", 312, 176, 289, 417);Sotware Tab Group 2
$APP_CHKBOX[19] = GUICtrlCreateCheckbox($Installs[19],320,200)  
$APP_CHKBOX[20] = GUICtrlCreateCheckbox($Installs[20],320,220)  
$APP_CHKBOX[21] = GUICtrlCreateCheckbox($Installs[21],320,240)  
$APP_CHKBOX[22] = GUICtrlCreateCheckbox($Installs[22],320,260) 
$APP_CHKBOX[23] = GUICtrlCreateCheckbox($Installs[23],320,280)  
$APP_CHKBOX[24] = GUICtrlCreateCheckbox($Installs[24],320,300)  
$APP_CHKBOX[25] = GUICtrlCreateCheckbox($Installs[25],320,320)  
$APP_CHKBOX[26] = GUICtrlCreateCheckbox($Installs[26],320,340) 
$APP_CHKBOX[27] = GUICtrlCreateCheckbox($Installs[27],320,360)  
$APP_CHKBOX[28] = GUICtrlCreateCheckbox($Installs[28],320,380)  
$APP_CHKBOX[29] = GUICtrlCreateCheckbox($Installs[29],320,400)  
$APP_CHKBOX[30] = GUICtrlCreateCheckbox($Installs[30],320,420)  
$APP_CHKBOX[31] = GUICtrlCreateCheckbox($Installs[31],320,440)  ;
$APP_CHKBOX[32] = GUICtrlCreateCheckbox($Installs[32],320,460)  
$APP_CHKBOX[33] = GUICtrlCreateCheckbox($Installs[33],320,480)  
$APP_CHKBOX[34] = GUICtrlCreateCheckbox($Installs[34],320,500)  
$APP_CHKBOX[35] = GUICtrlCreateCheckbox($Installs[35],320,520)  
$APP_CHKBOX[36] = GUICtrlCreateCheckbox($Installs[36],320,540)  
$APP_CHKBOX[37] = GUICtrlCreateCheckbox($Installs[37],320,560)  
GUICtrlCreateGroup("", -99, -99, 1, 1)

GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group4 = GUICtrlCreateGroup("tab1-group 3", 600, 176, 289, 417)
$APP_CHKBOX[38] = GUICtrlCreateCheckbox($Installs[38],610,200)  
$APP_CHKBOX[39] = GUICtrlCreateCheckbox($Installs[39],610,220)  
$APP_CHKBOX[40] = GUICtrlCreateCheckbox($Installs[40],610,240)  
$APP_CHKBOX[41] = GUICtrlCreateCheckbox($Installs[41],610,260)  ;
$APP_CHKBOX[42] = GUICtrlCreateCheckbox($Installs[42],610,280)  
$APP_CHKBOX[43] = GUICtrlCreateCheckbox($Installs[43],610,300)  
$APP_CHKBOX[44] = GUICtrlCreateCheckbox($Installs[44],610,320)  
$APP_CHKBOX[45] = GUICtrlCreateCheckbox($Installs[45],610,340)  ;
$APP_CHKBOX[46] = GUICtrlCreateCheckbox($Installs[46],610,360)  
$APP_CHKBOX[47] = GUICtrlCreateCheckbox($Installs[47],610,380)  
$APP_CHKBOX[48] = GUICtrlCreateCheckbox($Installs[48],610,400)  
$APP_CHKBOX[49] = GUICtrlCreateCheckbox($Installs[49],610,420)  
$APP_CHKBOX[50] = GUICtrlCreateCheckbox($Installs[50],610,440)  ;
$APP_CHKBOX[51] = GUICtrlCreateCheckbox($Installs[51],610,460)  
$APP_CHKBOX[52] = GUICtrlCreateCheckbox($Installs[52],610,480)  
$APP_CHKBOX[53] = GUICtrlCreateCheckbox($Installs[53],610,500)  
$APP_CHKBOX[54] = GUICtrlCreateCheckbox($Installs[54],610,520)  
$APP_CHKBOX[55] = GUICtrlCreateCheckbox($Installs[55],610,540)  
$APP_CHKBOX[56] = GUICtrlCreateCheckbox($Installs[56],610,560)  
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group5 = GUICtrlCreateGroup("tab1-group 4", 888, 176, 289, 417)
$APP_CHKBOX[57] = GUICtrlCreateCheckbox($Installs[57],898,200)  
$APP_CHKBOX[58] = GUICtrlCreateCheckbox($Installs[58],898,220)  
$APP_CHKBOX[59] = GUICtrlCreateCheckbox($Installs[59],898,240)  
$APP_CHKBOX[60] = GUICtrlCreateCheckbox($Installs[60],898,260)  ;
$APP_CHKBOX[61] = GUICtrlCreateCheckbox($Installs[61],898,280)  
$APP_CHKBOX[62] = GUICtrlCreateCheckbox($Installs[62],898,300)  
$APP_CHKBOX[63] = GUICtrlCreateCheckbox($Installs[63],898,320)  
$APP_CHKBOX[64] = GUICtrlCreateCheckbox($Installs[64],898,340)  ;
$APP_CHKBOX[65] = GUICtrlCreateCheckbox($Installs[65],898,360)  
$APP_CHKBOX[66] = GUICtrlCreateCheckbox($Installs[66],898,380)  
$APP_CHKBOX[67] = GUICtrlCreateCheckbox($Installs[67],898,400)  
$APP_CHKBOX[68] = GUICtrlCreateCheckbox($Installs[68],898,420)  
$APP_CHKBOX[69] = GUICtrlCreateCheckbox($Installs[69],898,440)  ;
$APP_CHKBOX[70] = GUICtrlCreateCheckbox($Installs[70],898,460)  
$APP_CHKBOX[71] = GUICtrlCreateCheckbox($Installs[71],898,480)  
$APP_CHKBOX[72] = GUICtrlCreateCheckbox($Installs[72],898,500)  
$APP_CHKBOX[73] = GUICtrlCreateCheckbox($Installs[73],898,520)  
$APP_CHKBOX[74] = GUICtrlCreateCheckbox($Installs[74],898,540)  
$APP_CHKBOX[75] = GUICtrlCreateCheckbox($Installs[75],898,560) 
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("END TASKS - (will run after everything else)", 8, 600, 553, 73)
$APP_CHKBOX[76] = GUICtrlCreateCheckbox($Installs[76] ,30,620) 
$APP_CHKBOX[77] = GUICtrlCreateCheckbox($Installs[77],30,640)
$APP_CHKBOX[78] = GUICtrlCreateCheckbox($Installs[78] ,165,620) 
$APP_CHKBOX[79] = GUICtrlCreateCheckbox($Installs[79] ,165,640)
$APP_CHKBOX[80] = GUICtrlCreateCheckbox($Installs[80] ,300,620) 
$APP_CHKBOX[81] = GUICtrlCreateCheckbox($Installs[81] ,300,640) 
$APP_CHKBOX[82] = GUICtrlCreateCheckbox($Installs[82] ,435,620) 
$APP_CHKBOX[83] = GUICtrlCreateCheckbox($Installs[83] ,435,640) 
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
GUICtrlCreateGroup("", -99, -99, 1, 1)
$TabSheet2 = GUICtrlCreateTabItem("Others...")
$Other_Group1 = GUICtrlCreateGroup("Other_Group1", 16, 168, 289, 417)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Other_group2 = GUICtrlCreateGroup("Group1", 311, 172, 289, 417)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Other_Group3 = GUICtrlCreateGroup("Group1", 608, 169, 289, 417)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Other_Group4 = GUICtrlCreateGroup("Group1", 904, 169, 289, 417)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateTabItem("")
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
; Update Top Menu Information
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
_SystemInfo()
_OSdate()
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
; RUN GUI Commands
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Case $exit_button
Exit_Run()
Case $Run_button
_Run()
Exit

EndSwitch
WEnd

;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
; -=-= Functions =-=-=-=-=-=-=-=-=
;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Func _SystemInfo() ;Get Computer name, and othre hardware info
Dim $System
_ComputerGetSystem($System)
If @error Then
    $error = @error
    $extended = @extended
    Switch $extended
        Case 1
            _ErrorMsg("Array contains no information.")
        Case 2
            _ErrorMsg("$colItems isnt an object.")
    EndSwitch
EndIf
    
    For $i = 1 To $System[0][0] Step 1
    $strComputer = $System[$i][0]
    next


;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 
;Update Menu Information in Gui
;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
GUICtrlSetData ($HNL, $strComputer)
GUICtrlSetColor($HNL,0x00bb00)

Endfunc

Func _OSdate() ; Part 2 OS_install date
$objWMIService2 = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2")
$colItems = $objWMIService2.ExecQuery("Select * from Win32_OperatingSystem") 
For $objItem in $colItems
$dtmInstallDate = WMIDateStringToDate($objItem.InstallDate)
                
   Next
   
 ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 
;Update Menu Information in Gui
;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
GUICtrlSetData ($IDL, $dtmInstallDate)
GUICtrlSetColor($IDL,0x00bb00)
endfunc

Func WMIDateStringToDate($dtmDate) ; Part 1 OS_install date
    Return (StringMid($dtmDate, 5, 2) & "/" & _
    StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _
    & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2))
EndFunc

Func _Run()

;-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=
;lOADING INI INSTALLS Commands
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
$Installs_R[1] = IniRead($Install_INI, "App1", "Run_Key", "1")
$Installs_R[2] = IniRead($Install_INI, "App2", "Run_Key", "1")
$Installs_R[3] = IniRead($Install_INI, "App3", "Run_Key", "1")
$Installs_R[4] = IniRead($Install_INI, "App4", "Run_Key", "1")
$Installs_R[5] = IniRead($Install_INI, "App5", "Run_Key", "1")
$Installs_R[6] = IniRead($Install_INI, "App6", "Run_Key", "1")
$Installs_R[7] = IniRead($Install_INI, "App7", "Run_Key", "1")
$Installs_R[8] = IniRead($Install_INI, "App8", "Run_Key", "1")
$Installs_R[9] = IniRead($Install_INI, "App9", "Run_Key", "1")
$Installs_R[10] = IniRead($Install_INI, "App10", "Run_Key", "1")
$Installs_R[11] = IniRead($Install_INI, "App11", "Run_Key", "1")
$Installs_R[12] = IniRead($Install_INI, "App12", "Run_Key", "1")
$Installs_R[13] = IniRead($Install_INI, "App13", "Run_Key", "1")
$Installs_R[14] = IniRead($Install_INI, "App14", "Run_Key", "1")
$Installs_R[15] = IniRead($Install_INI, "App15", "Run_Key", "1")
$Installs_R[16] = IniRead($Install_INI, "App16", "Run_Key", "1")
$Installs_R[17] = IniRead($Install_INI, "App17", "Run_Key", "1")
$Installs_R[18] = IniRead($Install_INI, "App18", "Run_Key", "1")
$Installs_R[19] = IniRead($Install_INI, "App19", "Run_Key", "1")
$Installs_R[20] = IniRead($Install_INI, "App20", "Run_Key", "1")
$Installs_R[21] = IniRead($Install_INI, "App21", "Run_Key", "1")
$Installs_R[22] = IniRead($Install_INI, "App22", "Run_Key", "1")
$Installs_R[23] = IniRead($Install_INI, "App23", "Run_Key", "1")
$Installs_R[24] = IniRead($Install_INI, "App24", "Run_Key", "1")
$Installs_R[25] = IniRead($Install_INI, "App25", "Run_Key", "1")
$Installs_R[26] = IniRead($Install_INI, "App26", "Run_Key", "1")
$Installs_R[27] = IniRead($Install_INI, "App27", "Run_Key", "1")
$Installs_R[28] = IniRead($Install_INI, "App28", "Run_Key", "1")
$Installs_R[29] = IniRead($Install_INI, "App29", "Run_Key", "1")
$Installs_R[30] = IniRead($Install_INI, "App30", "Run_Key", "1")
$Installs_R[31] = IniRead($Install_INI, "App31", "Run_Key", "1")
$Installs_R[32] = IniRead($Install_INI, "App32", "Run_Key", "1")
$Installs_R[33] = IniRead($Install_INI, "App33", "Run_Key", "1")
$Installs_R[34] = IniRead($Install_INI, "App34", "Run_Key", "1")
$Installs_R[35] = IniRead($Install_INI, "App35", "Run_Key", "1")
$Installs_R[36] = IniRead($Install_INI, "App36", "Run_Key", "1")
$Installs_R[37] = IniRead($Install_INI, "App37", "Run_Key", "1")
$Installs_R[38] = IniRead($Install_INI, "App38", "Run_Key", "1")
$Installs_R[39] = IniRead($Install_INI, "App39", "Run_Key", "1")
$Installs_R[40] = IniRead($Install_INI, "App40", "Run_Key", "1")
$Installs_R[41] = IniRead($Install_INI, "App41", "Run_Key", "1")
$Installs_R[42] = IniRead($Install_INI, "App42", "Run_Key", "1")
$Installs_R[43] = IniRead($Install_INI, "App43", "Run_Key", "1")
$Installs_R[44] = IniRead($Install_INI, "App44", "Run_Key", "1")
$Installs_R[45] = IniRead($Install_INI, "App45", "Run_Key", "1")
$Installs_R[46] = IniRead($Install_INI, "App46", "Run_Key", "1")
$Installs_R[47] = IniRead($Install_INI, "App47", "Run_Key", "1")
$Installs_R[48] = IniRead($Install_INI, "App48", "Run_Key", "1")
$Installs_R[49] = IniRead($Install_INI, "App49", "Run_Key", "1")
$Installs_R[50] = IniRead($Install_INI, "App50", "Run_Key", "1")
$Installs_R[51] = IniRead($Install_INI, "App51", "Run_Key", "1")
$Installs_R[52] = IniRead($Install_INI, "App52", "Run_Key", "1")
$Installs_R[53] = IniRead($Install_INI, "App53", "Run_Key", "1")
$Installs_R[54] = IniRead($Install_INI, "App54", "Run_Key", "1")
$Installs_R[55] = IniRead($Install_INI, "App55", "Run_Key", "1")
$Installs_R[56] = IniRead($Install_INI, "App56", "Run_Key", "1")
$Installs_R[57] = IniRead($Install_INI, "App57", "Run_Key", "1")
$Installs_R[58] = IniRead($Install_INI, "App58", "Run_Key", "1")
$Installs_R[59] = IniRead($Install_INI, "App59", "Run_Key", "1")
$Installs_R[60] = IniRead($Install_INI, "App60", "Run_Key", "1")
$Installs_R[61] = IniRead($Install_INI, "App61", "Run_Key", "1")
$Installs_R[62] = IniRead($Install_INI, "App62", "Run_Key", "1")
$Installs_R[63] = IniRead($Install_INI, "App63", "Run_Key", "1")
$Installs_R[64] = IniRead($Install_INI, "App64", "Run_Key", "1")
$Installs_R[65] = IniRead($Install_INI, "App65", "Run_Key", "1")
$Installs_R[66] = IniRead($Install_INI, "App66", "Run_Key", "1")
$Installs_R[67] = IniRead($Install_INI, "App67", "Run_Key", "1")
$Installs_R[68] = IniRead($Install_INI, "App68", "Run_Key", "1")
$Installs_R[69] = IniRead($Install_INI, "App69", "Run_Key", "1")
$Installs_R[70] = IniRead($Install_INI, "App70", "Run_Key", "1")
$Installs_R[71] = IniRead($Install_INI, "App71", "Run_Key", "1")
$Installs_R[72] = IniRead($Install_INI, "App72", "Run_Key", "1")
$Installs_R[73] = IniRead($Install_INI, "App73", "Run_Key", "1")
$Installs_R[74] = IniRead($Install_INI, "App74", "Run_Key", "1")
$Installs_R[75] = IniRead($Install_INI, "App75", "Run_Key", "1")
$Installs_R[76] = IniRead($Install_INI, "App76", "Run_Key", "1")
$Installs_R[77] = IniRead($Install_INI, "App77", "Run_Key", "1")
$Installs_R[78] = IniRead($Install_INI, "App78", "Run_Key", "1")
$Installs_R[79] = IniRead($Install_INI, "App79", "Run_Key", "1")
$Installs_R[80] = IniRead($Install_INI, "App80", "Run_Key", "1")
$Installs_R[81] = IniRead($Install_INI, "App81", "Run_Key", "1")
$Installs_R[82] = IniRead($Install_INI, "App82", "Run_Key", "1")
$Installs_R[83] = IniRead($Install_INI, "App83", "Run_Key", "1")

          for $i = 1 to $APP_CHKBOX[0] & $Installs_R[0]
           If (GUICtrlRead($APP_CHKBOX[$i]) == $GUI_CHECKED) Then 
            if $Installs_R[$i] = "1" then 
            else
             RunWait ($Installs_R[$i])
        endif
             
             else
          endif

          Next
          
EndFunc

Func Exit_Run() ;Function to exit script ASAP
Exit
EndFunc

Share this post


Link to post
Share on other sites

I made a script that I use for workstation installations. I think it's near what you want to do. See for yourself.

#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

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