Erst einmal vielen Dank für die Ansätze. Da ich noch frisch in AutoIT bin habe ich mit nochmals Gedanken gemacht und das Script weitergeschrieben und bin dabei auf "neue" Probleme gestoßen.
Ich möchte ja nur das für jede Zeile ein Button und eine Checkbox erstellt werden, bei mir im Script wird aber eine feste Anzahl vergeben, was das ganze sehr unflexibel macht und ich eigentlich keine Platzhalter möchte, sondern die genaue Anzahl der PC´s.
Außerdem wollte ich wenn ich die Checkbox $cball auswähle ein Haken bei allen anderen Checkboxen gesetzt wird.
Wenn ich den Install Button drücke soll bei allen ausgewählten Checkboxen ein Programm installiert werden.
Die data.txt liegt direkt im Scriptdir und schaut wie folgt aus:
PC1
PC2
PC3
Brauche für die offenen Fragen nochmals eine Denkansatz bitte.
Anbei noch das Script:
[autoit]
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=Test4.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#Include <File.au3>
$datei = FileOpen(@ScriptDir & "\data.txt")
$host1 = FileReadLine($datei,1)
$host2 = FileReadLine($datei,2)
$host3 = FileReadLine($datei,3)
$host4 = FileReadLine($datei,4)
FileClose(@ScriptDir & "\data.txt")
#Region ### START Koda GUI section ###
$Form1 = GUICreate("PC Update Tool", 683, 995, 199, 104)
$Ueberschrift = GUICtrlCreateLabel("Wähle einen, mehrere oder alle Clients aus", 61, 10, 566, 40, $SS_CENTER)
GUICtrlSetFont(-1, 18, 400, 0, "Comic Sans MS")
$Alle = GUICtrlCreateButton("Alle Clients", 20, 96, 168, 40)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
$Install = GUICtrlCreateButton("Install", 480, 88, 113, 57)
GUICtrlSetFont(-1, 20, 400, 0, "Comic Sans MS")
GUICtrlSetColor(-1, 0xFF0000)
$b1 = GUICtrlCreateButton($host1, 20, 210, 168, 40)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
$b2 = GUICtrlCreateButton($host2, 340, 210, 168, 40)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
$b3 = GUICtrlCreateButton($host3, 20, 275, 168, 40)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
$b4 = GUICtrlCreateButton($host4, 340, 275, 168, 40)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
$cball = GUICtrlCreateCheckbox("Auswahl Alle Clients", 216, 104, 129, 25)
$cb1 = GUICtrlCreateCheckbox($host1, 216, 215, 97, 25)
$cb2 = GUICtrlCreateCheckbox($host2, 544, 215, 97, 25)
$cb3 = GUICtrlCreateCheckbox($host3, 216, 280, 97, 25)
$cb4 = GUICtrlCreateCheckbox($host4, 544, 280, 97, 25)
GUISetState(@SW_SHOWNORMAL)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $b1
ShellExecuteWait("test.exe" , "" , "C:\Test" , "" , @SW_HIDE)
Case $b2
MsgBox(262208,"Button-Information","Button für PC2 wurde gedrückt")
Case $b3
MsgBox(262208,"Button-Information","Button für PC3 wurde gedrückt")
Case $Install
If GUICtrlRead($cb1) = $GUI_CHECKED Then
MsgBox(0,"","Checkbox aktiv")
Else
MsgBox(0,"","Checkbox inaktiv")
EndIf
EndSwitch
WEnd