Hey,
ich hab mir ein kleines Skript zum Einrichten meiner HPTC-Oberfläche geschrieben. Damit verändere ich die setup.ini des Hauptprogramms.
Hier mal der Vollständigkeit halber das Skript:
Spoiler anzeigen
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("GUICoordMode", 1)
[/autoit] [autoit][/autoit] [autoit]Global $GUI = GUICreate("Setup", 450, 600)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]$Button1 = GUICtrlCreateButton("Auflösung/Bilder", 100, 100,250,60)
$Button2 = GUICtrlCreateButton("Buttons", 100, 200,250,60)
$Button3 = GUICtrlCreateButton("Programme", 100, 300,250,60)
$Button4 = GUICtrlCreateButton("Reg-Tweaks", 100, 400,250,60)
GUISetState()
[/autoit] [autoit][/autoit] [autoit]while 1
$msg = GUIGetMsg()
switch $msg
case $GUI_EVENT_Close
Exit
case $button1
Opt("GUICoordMode", 1)
[/autoit] [autoit][/autoit] [autoit]Global $Gui1 = GUICreate("Form1", 633, 447, 193, 125)
Local $Label1 = GUICtrlCreateLabel("Auflösung", 20, 20, 89, 28)
GUICtrlSetFont(-1, 16, 400, 0, "MS Sans Serif")
Local $Input1 = GUICtrlCreateInput(IniRead (@ScriptDir & "\htpc.ini", "Auflösung", "Horizontal", ""), 16, 60, 110, 21)
Local $input2 = GUICtrlCreateInput(IniRead (@ScriptDir & "\htpc.ini", "Auflösung", "Vertikal", ""), 16, 90, 110, 21)
Local $Label2 = GUICtrlCreateLabel("Horizontal", 140, 60, 64, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
Local $Label3 = GUICtrlCreateLabel("Vertikal", 140, 90, 49, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
Local $Label5 = GUICtrlCreateLabel("Hintergrundbilder", 20, 140, 151, 28)
GUICtrlSetFont(-1, 16, 400, 0, "MS Sans Serif")
Local $Input3 = GUICtrlCreateInput(IniRead (@ScriptDir & "\htpc.ini", "Hintergrundbilder", "HauptGUI", ""), 16, 180, 316, 21)
Local $Input4 = GUICtrlCreateInput(IniRead (@ScriptDir & "\htpc.ini", "Hintergrundbilder", "EinstellungenGUI", ""), 16, 210, 316, 21)
Local $Input5 = GUICtrlCreateInput(IniRead (@ScriptDir & "\htpc.ini", "Hintergrundbilder", "BeendenGUI", ""), 16, 240, 316, 21)
Local $Label4 = GUICtrlCreateLabel("Haupt-GUI", 350, 180, 67, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
Local $Label6 = GUICtrlCreateLabel("Beenden-GUI", 350, 210, 86, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
Local $Label7 = GUICtrlCreateLabel("Einstellungen-GUI", 350, 240, 111, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
Local $Speichern = GUICtrlCreateButton("Speichern", 16, 300, 153, 49, 0)
Local $Back = GUICtrlCreateButton("Zurück", 179, 300, 153, 49, 0)
GUISetState()
while 1
$msg = GUIGetMsg()
switch $msg
case $GUI_EVENT_Close
Exit
case $Speichern
IniWrite(@ScriptDir & "\htpc.ini", "Auflösung", "Horizontal", GUICtrlRead($Input1))
Iniwrite(@ScriptDir & "\htpc.ini", "Auflösung", "Vertikal", GUICtrlRead($Input2))
Iniwrite(@ScriptDir & "\htpc.ini", "Hintergrundbilder", "HauptGUI", GUICtrlRead($Input3))
Iniwrite(@ScriptDir & "\htpc.ini", "Hintergrundbilder", "EinstellungenGUI", GUICtrlRead($Input4))
Iniwrite(@ScriptDir & "\htpc.ini", "Hintergrundbilder", "BeendenGUI", GUICtrlRead($Input5))
MsgBox(1, "", "Gespeichert")
case $Back
GUISetState(@SW_HIDE, $GUI1)
GUISetState(@SW_SHOW, $GUI)
ExitLoop
EndSwitch
Wend
case $button2
Opt("GUICoordMode", 1)
$Gui2 = GUICreate("Form2", 713, 497, 193, 125)
$Label1 = GUICtrlCreateLabel("Button", 16, 20, 57, 28)
GUICtrlSetFont(-1, 16, 400, 0, "MS Sans Serif")
Local $Input1 = GUICtrlCreateInput(IniRead (@ScriptDir & "\htpc.ini", "Button", "Left", ""), 16, 60, 150, 21)
Local $Input2 = GUICtrlCreateInput(IniRead (@ScriptDir & "\htpc.ini", "Button", "Width", ""), 16, 90, 150, 20)
Local $Input3 = GUICtrlCreateInput(IniRead (@ScriptDir & "\htpc.ini", "Button", "Height", ""), 16, 120, 150, 21)
Local $Input4 = GUICtrlCreateInput(IniRead (@ScriptDir & "\htpc.ini", "Button", "Style", ""), 16, 150, 150, 21)
Local $Input5 = GUICtrlCreateInput(IniRead (@ScriptDir & "\htpc.ini", "Button", "Top", ""), 16, 180, 150, 21)
Local $Input6 = GUICtrlCreateInput(IniRead (@ScriptDir & "\htpc.ini", "Button", "Abstand", ""), 16, 210, 150, 21)
Local $Input7 = GUICtrlCreateInput(IniRead (@ScriptDir & "\htpc.ini", "Button", "Farbe", ""), 16, 240, 150, 21)
Local $Input8 = GUICtrlCreateInput(IniRead (@ScriptDir & "\htpc.ini", "Button", "Fokusfarbe", ""), 16, 270, 150, 21)
Local $Label3 = GUICtrlCreateLabel("Left", 186, 60, 25, 40)
Local $Label4 = GUICtrlCreateLabel("Width", 186, 90, 32, 40)
Local $Label5 = GUICtrlCreateLabel("Height", 186, 120, 35, 40)
Local $Label6 = GUICtrlCreateLabel("Style", 186, 150, 27, 40)
Local $Label7 = GUICtrlCreateLabel("Top", 186, 180, 23, 40)
Local $Label8 = GUICtrlCreateLabel("Abstand", 186, 210, 31, 40)
Local $Label8 = GUICtrlCreateLabel("Farbe", 186, 240, 31, 40)
Local $Label9 = GUICtrlCreateLabel("Fokusfarbe", 186, 270, 72, 40)
Local $Label2 = GUICtrlCreateLabel("Buttonschrift", 360, 20, 105, 28)
GUICtrlSetFont(-1, 16, 400, 0, "MS Sans Serif")
Local $Input9 = GUICtrlCreateInput(IniRead (@ScriptDir & "\htpc.ini", "Buttonschrift", "Größe", ""), 360, 60, 150, 21)
Local $Input10 = GUICtrlCreateInput(IniRead (@ScriptDir & "\htpc.ini", "Buttonschrift", "Weight", ""), 360, 90, 150, 21)
Local $Input11 = GUICtrlCreateInput(IniRead (@ScriptDir & "\htpc.ini", "Buttonschrift", "Weight2", ""), 360, 120, 150, 21)
Local $Input12 = GUICtrlCreateInput(IniRead (@ScriptDir & "\htpc.ini", "Buttonschrift", "Attribute", ""), 360, 150, 150, 21)
Local $Input13 = GUICtrlCreateInput(IniRead (@ScriptDir & "\htpc.ini", "Buttonschrift", "Font", ""), 360, 180, 150, 21)
Local $Label3 = GUICtrlCreateLabel("Größe", 530, 60, 42, 20)
Local $Label10 = GUICtrlCreateLabel("Weight", 530, 90, 46, 20)
Local $Label11 = GUICtrlCreateLabel("Weight2", 530, 120, 53, 20)
Local $Label12 = GUICtrlCreateLabel("Attribute", 530, 150, 52, 20)
Local $Label13 = GUICtrlCreateLabel("Font", 530, 180, 30, 20)
Local $Speichern = GUICtrlCreateButton("Speichern", 16, 350, 150, 50, 0)
Local $Back = GUICtrlCreateButton("Zurück", 200, 350, 150, 50, 0)
GUISetState(@SW_SHOW)
while 1
$msg = GUIGetMsg()
switch $msg
case $GUI_EVENT_Close
Exitloop
case $Speichern
IniWrite(@ScriptDir & "\htpc.ini", "Button", "Left", GUICtrlRead($Input1))
IniWrite(@ScriptDir & "\htpc.ini", "Button", "Width", GUICtrlRead($Input2))
IniWrite(@ScriptDir & "\htpc.ini", "Button", "Height", GUICtrlRead($Input3))
IniWrite(@ScriptDir & "\htpc.ini", "Button", "Style", GUICtrlRead($Input4))
IniWrite(@ScriptDir & "\htpc.ini", "Button", "Top", GUICtrlRead($Input5))
IniWrite(@ScriptDir & "\htpc.ini", "Button", "Abstand", GUICtrlRead($Input6))
IniWrite(@ScriptDir & "\htpc.ini", "Button", "Farbe", GUICtrlRead($Input7))
IniWrite(@ScriptDir & "\htpc.ini", "Button", "Fokusfarbe", GUICtrlRead($Input8))
IniWrite(@ScriptDir & "\htpc.ini", "Buttonschrift", "Größe", GUICtrlRead($Input9))
IniWrite(@ScriptDir & "\htpc.ini", "Buttonschrift", "Weight", GUICtrlRead($Input10))
IniWrite(@ScriptDir & "\htpc.ini", "Buttonschrift", "Weight2", GUICtrlRead($Input11))
IniWrite(@ScriptDir & "\htpc.ini", "Buttonschrift", "Attribute", GUICtrlRead($Input12))
IniWrite(@ScriptDir & "\htpc.ini", "Buttonschrift", "Font", GUICtrlRead($Input13))
MsgBox(1, "", "Gespeichert")
case $Back
GUISetState(@SW_HIDE, $GUI2)
GUISetState(@SW_SHOW, $GUI)
ExitLoop
EndSwitch
Wend
case $button3
Opt("GUICoordMode", 1)
Global $GUI3 = GUICreate("Form3", 737, 400, 193, 91)
Local $Label1 = GUICtrlCreateLabel("Buttonbeschriftung", 16, 16, 160, 28)
GUICtrlSetFont(-1, 16, 400, 0, "MS Sans Serif")
Local $Label2 = GUICtrlCreateLabel("Programme", 300, 16, 103, 28)
GUICtrlSetFont(-1, 16, 400, 0, "MS Sans Serif")
Local $Input1 = GUICtrlCreateInput(IniRead (@ScriptDir & "\htpc.ini", "Programme", "Button1", ""), 300, 60, 300, 21)
Local $Input2 = GUICtrlCreateInput(IniRead (@ScriptDir & "\htpc.ini", "Programme", "Button2", ""), 300, 90, 300, 21)
Local $Input3 = GUICtrlCreateInput(IniRead (@ScriptDir & "\htpc.ini", "Programme", "Button3", ""), 300, 120, 300, 21)
Local $Input4 = GUICtrlCreateInput(IniRead (@ScriptDir & "\htpc.ini", "Programme", "Button4", ""), 300, 150, 300, 21)
Local $Input5 = GUICtrlCreateInput(IniRead (@ScriptDir & "\htpc.ini", "Programme", "Button5", ""), 300, 180, 300, 21)
Local $Input6 = GUICtrlCreateInput(IniRead (@ScriptDir & "\htpc.ini", "Programme", "Button6", ""), 300, 210, 300, 21)
Local $Input7 = GUICtrlCreateInput(IniRead (@ScriptDir & "\htpc.ini", "Buttonbeschriftung", "Button1", ""), 16, 60, 150, 21)
Local $Input8 = GUICtrlCreateInput(IniRead (@ScriptDir & "\htpc.ini", "Buttonbeschriftung", "Button2", ""), 16, 90, 150, 21)
Local $Input9 = GUICtrlCreateInput(IniRead (@ScriptDir & "\htpc.ini", "Buttonbeschriftung", "Button3", ""), 16, 120, 150, 21)
Local $Input10 = GUICtrlCreateInput(IniRead (@ScriptDir & "\htpc.ini", "Buttonbeschriftung", "Button4", ""), 16, 150, 150, 21)
Local $Input11 = GUICtrlCreateInput(IniRead (@ScriptDir & "\htpc.ini", "Buttonbeschriftung", "Button5", ""), 16, 180, 150, 21)
Local $Input12 = GUICtrlCreateInput(IniRead (@ScriptDir & "\htpc.ini", "Buttonbeschriftung", "Button6", ""), 16, 210, 150, 21)
Local $Speichern = GUICtrlCreateButton("Speichern", 16, 275, 150, 50, 0)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
Local $Back = GUICtrlCreateButton("Zurück", 186, 275, 150, 50, 0)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
Local $Label3 = GUICtrlCreateLabel("Button1", 186, 60, 48, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
Local $Label4 = GUICtrlCreateLabel("Button2", 186, 90, 48, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
Local $Label5 = GUICtrlCreateLabel("Button3", 186, 120, 48, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
Local $Label6 = GUICtrlCreateLabel("Button4", 186, 150, 48, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
Local $Label7 = GUICtrlCreateLabel("Button5", 186, 180, 48, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
Local $Label8 = GUICtrlCreateLabel("Button6", 186, 210, 48, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
Local $Label9 = GUICtrlCreateLabel("Programm1", 620, 60, 74, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
Local $Label10 = GUICtrlCreateLabel("Programm2", 620, 90, 74, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
Local $Label11 = GUICtrlCreateLabel("Programm3", 620, 120, 74, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
Local $Label12 = GUICtrlCreateLabel("Programm4", 620, 150, 74, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
Local $Label13 = GUICtrlCreateLabel("Programm5", 620, 180, 74, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
Local $Label14 = GUICtrlCreateLabel("Programm6", 620, 210, 74, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
while 1
$msg = GUIGetMsg()
switch $msg
case $GUI_EVENT_Close
Exit
case $Speichern
IniWrite(@ScriptDir & "\htpc.ini", "Programme", "Button1", GUICtrlRead($Input1))
IniWrite(@ScriptDir & "\htpc.ini", "Programme", "Button2", GUICtrlRead($Input2))
IniWrite(@ScriptDir & "\htpc.ini", "Programme", "Button3", GUICtrlRead($Input3))
IniWrite(@ScriptDir & "\htpc.ini", "Programme", "Button4", GUICtrlRead($Input4))
IniWrite(@ScriptDir & "\htpc.ini", "Programme", "Button5", GUICtrlRead($Input5))
IniWrite(@ScriptDir & "\htpc.ini", "Programme", "Button6", GUICtrlRead($Input6))
IniWrite(@ScriptDir & "\htpc.ini", "Buttonbeschriftung", "Button1", GUICtrlRead($Input7))
IniWrite(@ScriptDir & "\htpc.ini", "Buttonbeschriftung", "Button2", GUICtrlRead($Input8))
IniWrite(@ScriptDir & "\htpc.ini", "Buttonbeschriftung", "Button3", GUICtrlRead($Input9))
IniWrite(@ScriptDir & "\htpc.ini", "Buttonbeschriftung", "Button4", GUICtrlRead($Input10))
IniWrite(@ScriptDir & "\htpc.ini", "Buttonbeschriftung", "Button5", GUICtrlRead($Input11))
IniWrite(@ScriptDir & "\htpc.ini", "Buttonbeschriftung", "Button6", GUICtrlRead($Input12))
MsgBox(1, "", "Gespeichert")
case $Back
GUISetState(@SW_HIDE, $GUI3)
GUISetState(@SW_SHOW, $GUI)
ExitLoop
EndSwitch
Wend
case $button4
EndSwitch
Wend
Der 4 Punkt (Button) bereitet mir aber etwas Kopfzerbrechen.
Ich möchte damit verschiedene Änderungen in der Registrierung automatisch vornehmen. Wie das funktioniert weiss ich schon (Regread, Redwrite usw.), allerdings hat meine bisherige Liste keinen Anspruch auf Vollständigkeit und unterscheidet sich auch von Betriebssystem zu Betriebssystem. Also würde ich das gerne Auslagern, auch um Einträge nachträglich ohne neu zu compilieren hinzufügen zu können.
Bei einer Auslagerung auf eine .ini müsste ich aber ja für jeden Reg-tweak schonmal einen "Key" anlegen, ich kenne aber die genaue Anzahl der Reg-tweaks nicht und die Liste wird sich im Laufe der Zeit vermutlich auch erweitern.
Soweit ich es verstanden habe, ist es auch nicht möglich eine fertige .exe zu verändern, d.h. ich kann dem Setup-Programm nachträgliche Einträge in der .ini nichtmehr mitteilen.
So, ich hoffe von euch kennt jemand eine Lösung.
Gruß nuts