Hallo,
Ich habe folgendes Problem:
Ich möchte das am anfang des Programmes aus einer INI datei jeder KEY in eine andere VAR kommt!
Das hat folgenden Grund:
ich mache gerade ein PS2 ISO OVERVIEW tool, bei click auf ein Bild soll das nächste kommen.
Die bilder sind in der ini gespeichert.
Hier mein code:
Spoiler anzeigen
#RequireAdmin
#region
#cs
Global Const $Path_Pic_1 = @ScriptDir & "\Bild1.bmp"
Global Const $Path_Pic_2 = @ScriptDir & "\Bild2.bmp"
Global $Pic_State = $Path_Pic_1
#ce
#endregion
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
DirCreate(@ScriptDir & "\cover\")
DirCreate(@ScriptDir & "\opt\")
If not FileExists(@ScriptDir & "\opt\options.ini") Then
IniWrite(@ScriptDir & "\opt\options.ini","MAIN","Success","true")
EndIf
If not FileExists(@ScriptDir & "\opt\path.ini") Then
MsgBox(0,"INFO","Please go to Options and set youre Emulator path!")
EndIf
If not FileExists(@ScriptDir & "\cover\default.jpg") Then
FileInstall("C:\Users\Dustin\Desktop\Projekte\PS2 ISO Overview\default.jpg", @ScriptDir & "\cover\default.jpg")
EndIf
$allgames = IniReadSection(@ScriptDir & "\opt\games.ini","MAIN")
If @error Then
MsgBox(4096, "", "Error occurred, probably no INI file.")
Else
For $i = 1 To $allgames[0][0]
MsgBox(4096, "", "Key: " & $allgames[$i][0] & @CRLF & "Value: " & $allgames[$i][1])
Next
EndIf
;MsgBox(0,"",@ScriptDir & "\cover\default.jpg")
#Region ### START Koda GUI section ### Form=C:\Users\Dustin\Desktop\Projekte\PS2 ISO Overview\gui_main.kxf
$gui_main = GUICreate("PlayStation 2 ISO Overview by ChaosClan", 345, 538, 192, 124)
GUISetFont(12, 400, 0, "Comic Sans MS")
$pb_game = GUICtrlCreatePic(@ScriptDir & "\cover\default.jpg", 8, 8, 321, 401)
$bt_start_game = GUICtrlCreateButton("START GAME", 8, 424, 147, 49)
$bt_options = GUICtrlCreateButton("Options...", 184, 424, 139, 49)
$Register = GUICtrlCreateButton("Register", 120, 488, 91, 41)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
#Region ### START Koda GUI section ### Form=C:\Users\Dustin\Desktop\Projekte\PS2 ISO Overview\gui_options.kxf
$gui_options = GUICreate("Options...", 178, 318, 192, 124)
GUISetFont(12, 400, 0, "Comic Sans MS")
$bt_add_game_gui = GUICtrlCreateButton("Add Game", 8, 16, 161, 57, $BS_NOTIFY)
$bt_emulator_path = GUICtrlCreateButton("Emulator Path", 8, 88, 161, 57, $BS_NOTIFY)
$bt_credits_options = GUICtrlCreateButton("Credits", 8, 160, 161, 57, $BS_NOTIFY)
$bt_apply = GUICtrlCreateButton("Apply", 8, 232, 161, 57, $BS_NOTIFY)
GUISetState(@SW_HIDE)
#EndRegion ### END Koda GUI section ###
#Region ### START Koda GUI section ### Form=C:\Users\Dustin\Desktop\Projekte\PS2 ISO Overview\gui_add_game.kxf
$gui_add_game = GUICreate("Add Game", 419, 204, 192, 124)
GUISetFont(12, 400, 0, "Comic Sans MS")
$ib_iso_path = GUICtrlCreateInput("", 128, 8, 233, 31, $GUI_SS_DEFAULT_INPUT)
$Label1 = GUICtrlCreateLabel("ISO File:", 8, 8, 75, 27, 0)
$bt_iso_select = GUICtrlCreateButton("...", 376, 8, 35, 33, $BS_NOTIFY)
$Label2 = GUICtrlCreateLabel("Cover Path:", 8, 64, 87, 27, 0)
$ib_cover_path = GUICtrlCreateInput("", 128, 64, 233, 31, $GUI_SS_DEFAULT_INPUT)
$bt_cover_select = GUICtrlCreateButton("...", 376, 64, 35, 33, $BS_NOTIFY)
$bt_add_game = GUICtrlCreateButton("ADD GAME", 8, 168, 403, 25, $BS_NOTIFY)
$Label3 = GUICtrlCreateLabel("Name:", 8, 120, 49, 27)
$ib_name = GUICtrlCreateInput("", 128, 120, 233, 31)
GUISetState(@SW_HIDE)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $bt_add_game_gui
GUISetState(@SW_SHOW, $gui_add_game)
Case $bt_emulator_path
$path = InputBox("Please give me youre Path to the PS2 Emulator","Youre Path:")
IniWrite(@ScriptDir & "\opt\path.ini","MAIN","Path",$path)
Case $bt_credits_options
MsgBox(0,"INFO","Coded by Dustin" & @CRLF & "Made in AutoIT")
Case $bt_start_game
[/autoit] [autoit][/autoit] [autoit]Case $bt_options
GUISetState(@SW_SHOW, $gui_options)
Case $bt_apply
GUISetState(@SW_HIDE, $gui_options)
Case $Register
MsgBox(0,"INFO","Please go to ... and download the register Tool!")
Case $bt_iso_select
$isopath = FileOpenDialog("ISO...", "C:\", "ISO Files (*.iso; *.bin;)")
GUICtrlSetData($ib_iso_path, $isopath)
Case $bt_cover_select
$coverpath = FileOpenDialog("ISO...", "C:\", "IMG Files (*.jpg; *.jpeg; *.png; *.bmp)")
GUICtrlSetData($ib_cover_path, $coverpath)
Case $bt_add_game
If $ib_iso_path = "" Then
MsgBox(64,"ERROR","Restarting... Please dont leave a the ISO path blank!")
Exit
EndIf
If $ib_name = "" Then
MsgBox(64,"ERROR","Restarting... Please dont leave a the name blank!")
Exit
EndIf
If $ib_cover_path = "" Then
$v = 1
Else
$v = 0
EndIf
$iso_var = GUICtrlRead($ib_iso_path)
$cover_var = GUICtrlRead($ib_cover_path)
$name_var = GUICtrlRead($ib_name)
If $v = 1 Then
IniWrite(@ScriptDir & "\opt\games.ini","MAIN",$name_var,$iso_var)
IniWrite(@ScriptDir & "\opt\cover.ini","MAIN",$name_var,$cover_var)
MsgBox(0,"INFO","Game added!")
Else
MsgBox(0,"INFO","use default cover")
IniWrite(@ScriptDir & "\opt\games.ini","MAIN",$name_var,$iso_var)
IniWrite(@ScriptDir & "\opt\cover.ini","MAIN",$name_var,"default")
MsgBox(0,"INFO","Game added!")
EndIf
Case $pb_game
#cs
if $Pic_State == $Path_Pic_1 Then
GUICtrlSetImage($GUI_PictureBox, $Path_Pic_2)
$Pic_State = $Path_Pic_2
ElseIf $Pic_State == $Path_Pic_2 Then
GUICtrlSetImage($GUI_PictureBox, $Path_Pic_1)
$Pic_State = $Path_Pic_1
EndIf
#ce
EndSwitch
WEnd