Aldrinn Posted March 10, 2010 Share Posted March 10, 2010 Dear all, I have an .ini file with programs i want to install. I have 3 vars made. Var1 = Location of installer Var2 = Name of installer Var3 = Location where they have installed if they have installed Now is my question: In var3 he search for the program is already installed. Now i want to make a list with what he already has installed and what not. When you play my script you see a list with programs that you can install. I want at the left an list with what you can install because it is not allready installed. And on the right an list what already is installed and not can installed again. Here is my script: expandcollapse popup#include <GUIConstantsEx.au3> #include <Array.au3> ; Aanpassen deze computer op bureaublad ;regwrite("HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}","LocalizedString","REG_EXPAND_SZ","%USERNAME% on %COMPUTERNAME%") $ininaam = @ScriptDir & "\" & StringTrimRight(@scriptname,4) & ".ini" $secties = IniReadSectionNames($ininaam) $aantal = $secties[0] ; Array to hold ControlIDs if the checkboxes Global $aChecks[$aantal] ;MsgBox(1043, "test",$aantal,"","") If $aantal <= 5 Then $hoogte = 170 Else $hoogte = 190 + (($aantal -5)* 20) Endif $hGUI = GUICreate("Installatie programmas", 480, $hoogte) ; Create the checkboxes For $i = 0 To $secties[0] -1 $clabel = iniread($ininaam,$secties[$i +1], "var2", "Fout") ;kijk of bestaat ;als bestaat dan naar $alabels ;anders $achecks $aChecks[$i] = GUICtrlCreateCheckbox($clabel, 10, 10 + (20 * $i), 200, 20) GUICtrlSetState ($aChecks[$i], $GUI_CHECKED) Next ;_ArrayDisplay($achecks) ;$AppBinFile = IniRead($ininaam,$secties[$i +1], "var3", "Fout") $uncheck_button = GUICtrlCreateButton("uncheck all",100,($hoogte - 55),80,20) $check_button = GUICtrlCreateButton("check all",10,($hoogte - 55),80,20) $hButton1 = GUICtrlCreateButton("Installeren", 345, ($hoogte - 35), 60, 25) $hButton2 = GUICtrlCreateButton("Sluiten", 410, ($hoogte - 35), 60, 25) $hlabel = GUICtrlCreateLabel("", 10, ($hoogte - 75), 300, 20) $hProgress = GUICtrlCreateProgress(240, ($hoogte - 55), 230, 15) $footer = GUICtrlCreateLabel("", 10, ($hoogte - 25), 330, 20) GUISetState() GUICtrlSetData($footer, "Brainwork Systems B.V. | 033 - 247 15 65 | info@brainwork.nl") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $uncheck_button _Uncheck() Case $check_button _Check() Case $hButton1 _Installeren() Case $hButton2 Exit EndSwitch WEnd Func _Uncheck() Local $i For $i = 0 To Ubound($aChecks) -1 GUICtrlSetState ($aChecks[$i], $GUI_UNCHECKED) Next EndFunc Func _Check() Local $i For $i = 0 To Ubound($aChecks) -1 GUICtrlSetState ($aChecks[$i], $GUI_CHECKED) Next EndFunc Func _Installeren() ; See how many apps to install - determines how far progress bar moves each time Local $iCount = 0 For $i = $aChecks[0] To $aChecks[$aantal -1] 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 $secties[0] -1 If GUICtrlRead($aChecks[$i]) = 1 Then $llabel = iniread($ininaam,$secties[$i +1], "var2", "Fout") GUICtrlSetData($hlabel, "Installeren " & $llabel) ; Simulate install RunWait($ininaam) Sleep(1000) $iProgress += 100/$iCount GUICtrlSetData($hProgress, $iProgress) EndIf Next ; We have finished GUICtrlSetData($hlabel, "Installatie compleet") GUICtrlSetState($hbutton1, $GUI_DISABLE) GUICtrlSetState($check_button, $GUI_DISABLE) GUICtrlSetState($uncheck_button, $GUI_DISABLE) EndFunc I hope you understand and can help me. Aldrinn Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now