Hi,
ich bin noch sehr neu bei AutoIT und möchte für mich ein kleines Programm haben das aus einer *.txt Zeile für Zeile ausliest und aus jeder Zeile automatisch einen Button + Checkbox erstellt
So schaut die txt aus:
PC1
PC2
PC3
Über die
Checkbox kann ich dann am Ende einen, mehrere oder alle PC´s auswählen die dann ein Prog installieren wenn ich auf Install klicke.
Leider bekomme ich als Anfänger nur die Buttons mit Programmaufruf hin, aber schaffe es nicht die einzelnen Zeilen der txt in einen Button und eine Checkbox um zu wandeln.
Habe euch mal ein Bsp gemacht wie es später ungefähr aus sehen soll.
[autoit]#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=PC.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=c:\pc\pc.kxf
$Form1 = GUICreate("PC Update Tool", 609, 430, 192, 125)
$Ueberschrift = GUICtrlCreateLabel("Wähle einen oder alle Clients aus", 13, 10, 390, 40)
GUICtrlSetFont(-1, 18, 400, 0, "Comic Sans MS")
$PC1 = GUICtrlCreateButton("PC1", 20, 180, 200, 40)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
$PC2 = GUICtrlCreateButton("PC2", 20, 240, 200, 40)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
$PC3 = GUICtrlCreateButton("PC3", 20, 304, 200, 40)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
$Alle = GUICtrlCreateButton("Alle PC´s", 20, 64, 200, 40)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
$Auswahl1 = GUICtrlCreateCheckbox("Auswahl PC1", 248, 184, 97, 25)
$Auswahl2 = GUICtrlCreateCheckbox("Auswahl PC2", 248, 240, 97, 25)
$Auswahl3 = GUICtrlCreateCheckbox("Auswahl PC3", 248, 312, 97, 25)
$AuswahlAlle = GUICtrlCreateCheckbox("Auswahl Alle PC´s", 248, 64, 129, 25)
$Install = GUICtrlCreateButton("Install", 440, 168, 113, 57)
GUICtrlSetFont(-1, 20, 400, 0, "Comic Sans MS")
GUICtrlSetColor(-1, 0xFF0000)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $PC1
ShellExecuteWait("test.exe" , "" , "C:\Test" , "" , @SW_HIDE)
Case $PC2
MsgBox(262208,"Button-Information","Button für PC2 wurde gedrückt")
Case $PC3
MsgBox(262208,"Button-Information","Button für PC3 wurde gedrückt")
EndSwitch
WEnd
Aus einer txt auslesen und eine msgbox erstellen klappt
[autoit]
$datei = FileRead("pc.txt")
$variable = StringSplit($datei,
@CRLF)
For $i = 1 To $variable[0] Step 2
[/autoit][autoit][/autoit][autoit]MsgBox(0, "", $variable[$i])
[/autoit][autoit][/autoit][autoit]Next
[/autoit]nur die Buttons + Checkboxen bekomme ich nicht hin. Event hat wer einen kleinen Tipp für mich
Besten Dank