FileOpenDialog

  • Sobald ich das FileOpenDialog(Case $Directory) benutze und nicht selber den Standort eingebe( $Path = Input-Feld), schreibt das Programm nicht in meine .ini Datei?

    [autoit]


    Case $Add
    $anzahl = 1
    Do
    If iniRead("X.ini", "Item", $anzahl, "") = "" Then
    $z = GuiCtrlRead($Name)
    $b = GuiCtrlRead($Path)
    $c = GuiCtrlRead($Priority)
    IniWrite("X.ini", "Item", $anzahl, $z)
    IniWrite("X.ini", "Item", $anzahl&"b", $b)
    IniWrite("X.ini", "Item", $anzahl&"c", $c)
    MsgBox( 64, "", "Profil erfolgreich erstellt")
    Exit
    Endif
    $anzahl = $anzahl + 1
    Until $anzahl = 15
    Case $Directory
    $pfad = FileOpenDialog( "Programm auswählen", @ProgramFilesDir, "Anwendungen (*.exe)")
    GuiCtrlSetData( $Path, $pfad)

    [/autoit]

    Einmal editiert, zuletzt von UltimateX (19. Februar 2010 um 16:41)

  • Aber ich setze mit GuiCtrlSetData doch den Inhalt der FileOpenDialog-Abfrage in ein Input-Feld, das später wieder von dem anderen Case-Zweig abgefragt wird!

  • Hallo Ultimatex,

    GuiCtrlRead ist es geliechgültig wie die Daten in das Input-Feld gekommen sind, sie werden auf jeden Fall ausgelesenI. Poste doch einmal dein komplettes Skript,

    mfg (Auto)Bert

  • der case der input wird nicht aufgerufen wenn du mit guictrlsetdata etwas ins input hineinschreibst

    mach dir doch ne SchreibeInIni funktion oder so, dann kannste die in deinem case anhängen und hast nix doppelt drin

  • [autoit]


    #include <GUIConstants.au3>
    #Region ### START Koda GUI section ###
    $Window = GUICreate("Profil hinzufügen", 260, 223, 438, 293)
    $Directory = GUICtrlCreateButton("Durchsuchen", 8, 72, 123, 25, 0)
    $Name = GUICtrlCreateInput("", 8, 25, 241, 21)
    $Label1 = GUICtrlCreateLabel("1. Profil benennen:", 8, 8, 93, 17)
    $Path = GUICtrlCreateInput("", 8, 104, 241, 21)
    $X = GUICtrlCreateCombo("1", 8, 160, 185, 25)
    GUICtrlSetData(-1, "1|2|3|4|5|6")
    $Label2 = GUICtrlCreateLabel("2. SO wählen:", 8, 56, 113, 17)
    $Label3 = GUICtrlCreateLabel("3. Unterprofil wählen:", 8, 136, 179, 17)
    $Add = GUICtrlCreateButton("Profil erstellen", 8, 192, 243, 25, 0)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit][autoit][/autoit][autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $Add
    $anzahl = 1
    Do
    If iniRead("X.ini", "Item", $anzahl, "") = "" Then
    $z = GuiCtrlRead($Name)
    $b = GuiCtrlRead($Path)
    $c = GuiCtrlRead($X)
    IniWrite("X.ini", "Item", $anzahl, $z)
    IniWrite("X.ini", "Item", $anzahl&"b", $b)
    IniWrite("X.ini", "Item", $anzahl&"c", $c)
    MsgBox( 64, "", "Profil erfolgreich erstellt")
    Exit
    Endif
    $anzahl = $anzahl + 1
    Until $anzahl = 15
    Case $Directory
    $pfad = FileOpenDialog( "SO auswählen", @ProgramFilesDir, "SO (*.exe)")
    GuiCtrlSetData( $Path, $pfad)
    Case $GUI_EVENT_CLOSE
    Exit
    EndSwitch
    WEnd

    [/autoit]

    Einmal editiert, zuletzt von UltimateX (19. Februar 2010 um 16:21)

  • Hallo

    wenn du den Pfad für die Ini korrekt (mit @scriptdir) angibst klappt alles:

    Spoiler anzeigen
    [autoit]

    #Region ### START Koda GUI section ###
    $Window = GUICreate("Profil hinzufügen", 260, 223, 438, 293)
    $Directory = GUICtrlCreateButton("Durchsuchen", 8, 72, 123, 25, 0)
    $Name = GUICtrlCreateInput("", 8, 25, 241, 21)
    $Label1 = GUICtrlCreateLabel("1. Profil benennen:", 8, 8, 93, 17)
    $Path = GUICtrlCreateInput("", 8, 104, 241, 21)
    $X = GUICtrlCreateCombo("1", 8, 160, 185, 25)
    GUICtrlSetData(-1, "1|2|3|4|5|6")
    $Label2 = GUICtrlCreateLabel("2. SO wählen:", 8, 56, 113, 17)
    $Label3 = GUICtrlCreateLabel("3. Unterprofil wählen:", 8, 136, 179, 17)
    $Add = GUICtrlCreateButton("Profil erstellen", 8, 192, 243, 25, 0)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $Add
    $anzahl = 1
    Do
    If IniRead("X.ini", "Item", $anzahl, "") = "" Then
    $z = GUICtrlRead($Name)
    $b = GUICtrlRead($Path)
    $c = GUICtrlRead($X)
    $IniName = @ScriptDir & "\X.INI" ;Fileopendialog verändert das Verzeichnis daher kompletter Pfad nötig damit ini ander richtigeb Stelle gespeichert wird
    IniWrite($IniName, "Item", $anzahl, $z)
    IniWrite($IniName, "Item", $anzahl & "b", $b)
    IniWrite($IniName, "Item", $anzahl & "c", $c)
    MsgBox(64, "", "Profil erfolgreich erstellt")
    Exit
    EndIf
    $anzahl = $anzahl + 1
    Until $anzahl = 15
    Case $Directory
    $pfad = FileOpenDialog("SO auswählen", @ProgramFilesDir, "SO (*.exe)")
    GUICtrlSetData($Path, $pfad)
    Case -3 ;$GUI_EVENT_CLOSE
    Exit
    EndSwitch
    WEnd

    [/autoit]

    mfg (Auto)Bert

  • Ja jetzt funktioniert dieser Teil des Skriptes super :D
    Danke, das es daran liegt darauf wäre ich nie selber gekommen. :thumbup: