1. Dashboard
  2. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  3. Forenregeln
  4. Forum
    1. Unerledigte Themen
  • Anmelden
  • Registrieren
  • Suche
Alles
  • Alles
  • Artikel
  • Seiten
  • Forum
  • Erweiterte Suche
  1. AutoIt.de - Das deutschsprachige Forum.
  2. Mitglieder
  3. casi4712

Beiträge von casi4712

  • parameter parsen mit Leerzeichen im Pfad

    • casi4712
    • 3. Juni 2024 um 18:06

    Stimmt, wie gesagt habs ja dann auch noch gesehen dass das so nicht hinhaut, deswegen der Nachtrag. Ok du hast Recht wenn ich im resultierenden PS Script diese Zeile ersetze dann funzt es, aber wie übergebe ich das nun korrekt in meiner ElsIf Anweisung an $params, damit das so erzeigt wird?


    lg und recht herzlichen Dank

  • parameter parsen mit Leerzeichen im Pfad

    • casi4712
    • 3. Juni 2024 um 16:52

    Hm, ist doch echt zum Schweinemelken, ich habs jetzt so korrigiert wie du sagtest:

    AutoIt
    	ElseIf StringRight($filePath, 4) = ".mp3" Then ;Audiofile
            ;$splayer = '"c:\Program Files\VideoLAN\VLC\vlc.exe"'
           Return ' -i "c:\Program Files\VideoLAN\VLC\vlc.exe" -Idummy '
        Else

    die resultierende PS Zeile sieht ja eigentlich gut aus

    $psexecArgs = "-u $username -p $password \\" + $computer + " -i "c:\Program Files\VideoLAN\VLC\vlc.exe" -Idummy " + $batchFilePath

    passiert leider immer noch nix, werd langsam wahnsinnig;)


    Achso noch was, habe das resultierende mal in ISE geöffnet, da wird folgendes bemeckert:

    Code
    $jobs = foreach ($computer in $computers) {
        if ($computer -ne $env:COMPUTERNAME) {
            $psexecArgs = "-u $username -p $password \\" + $computer + " -i "c:\Program Files\VideoLAN\VLC\vlc.exe" -Idummy " + $batchFilePath
            Start-Job -ScriptBlock {
                param($psexecCommand, $psexecArgs)
                Start-Process -FilePath $psexecCommand -ArgumentList $psexecArgs -NoNewWindow -Wait

    Das c:\Programm wird unterstrichen, Meldung: Unerwartetes Token "c:\Program" in Ausdruck oder Anweisung.
    + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnexpectedToken

    lg

  • parameter parsen mit Leerzeichen im Pfad

    • casi4712
    • 3. Juni 2024 um 15:08

    so danke noch mal für das Feedback, ich habe das jetzt dahingehend angepasst, hoffe hatte dich richtig verstanden, aber geht leider immer noch nicht:


    AutoIt
    Func GetExecutionParameter($filePath)
        ; PSEXEC Parameter
        Local $params = ""
        Local $viewer = 'C:\Program Files (x86)\Google\Picasa3\PicasaPhotoViewer.exe'
    
        If BitAND(GUICtrlRead($check_c), $GUI_CHECKED) Then $params &= " -f -c"
        If BitAND(GUICtrlRead($check_i), $GUI_CHECKED) Then $params &= " -i"
        If BitAND(GUICtrlRead($check_h), $GUI_CHECKED) Then $params &= " -h"
        If BitAND(GUICtrlRead($check_l), $GUI_CHECKED) Then $params &= " -l"
        If BitAND(GUICtrlRead($check_e), $GUI_CHECKED) Then $params &= " -e"
        If BitAND(GUICtrlRead($check_s), $GUI_CHECKED) Then $params &= " -s"
        If BitAND(GUICtrlRead($check_x), $GUI_CHECKED) Then $params &= " -x"
        If BitAND(GUICtrlRead($check_v), $GUI_CHECKED) Then $params &= " -v"
        If BitAND(GUICtrlRead($check_d), $GUI_CHECKED) Then $params &= " -d"
    
        If StringRight($filePath, 4) = ".ps1" Then
            Return $params & ' powershell -NoProfile -ExecutionPolicy Bypass -File '
        ElseIf StringRight($filePath, 4) = ".bat" Then
            Return $params & ' -i cmd /c '
        ElseIf StringRight($filePath, 4) = ".cmd" Then
            Return $params & ' -i cmd /c '
        ElseIf StringRight($filePath, 4) = ".exe" Then
            Return $params & ' -i '
        ElseIf StringRight($filePath, 4) = ".vbs" Then
            Return $params & ' cscript.exe '
        ElseIf StringRight($filePath, 4) = ".jpg" Then
            If GUICtrlRead($check_i) = $GUI_UNCHECKED Then
    			Return $params & ' start "" '
            Else
                Return $params & ' cmd /c '
            EndIf
    
    
    	ElseIf StringRight($filePath, 4) = ".mp3" Then ;Audiofile
            $splayer = 'c:\Program Files\VideoLAN\VLC\vlc.exe' ; geändert
           Return $params & ' "' & $splayer & '" -Idummy ' ;Leerzeichen eingefügt
    
    
        Else
            Return $params & ' cmd /c '
        EndIf
    EndFunc
    
    Func ExecuteParallelBatch($batchFilePath)
    Global $username, $password, $PsExecPath, $hostFilePath
    Local $psScriptPath = @TempDir & "\temp_script.ps1"
    Local $psexecArgs
    Local $psScriptContent
    Local $player = """ C:\Program Files (x86)\Google\Picasa3\PicasaPhotoViewer.exe"""
    ;Local $splayer = 'c:\Program Files\VideoLAN\VLC\vlc.exe'
    ; Bestimme den Parameter für den Ausführungstyp basierend auf der Dateiendung
    Local $parameter = GetExecutionParameter($batchFilePath)
    MsgBox(64, "Info", $Parameter)
    ; Powershell-Skript für parallele Jobausführung
    $psScriptContent = '$hostFilePath = "' & $hostFilePath & '"' & @CRLF & _
    '$computers = Get-Content -Path $hostFilePath' & @CRLF & _
    '$username = "' & $username & '"' & @CRLF & _
    '$password = "' & $password & '"' & @CRLF & _
    '$securePassword = ConvertTo-SecureString $password -AsPlainText -Force' & @CRLF & _
    '$credential = New-Object System.Management.Automation.PSCredential($username, $securePassword)' & @CRLF & _
    '$batchFilePath = "' & $batchFilePath & '"' & @CRLF & _
    '$psexecCommand = "' & $PsExecPath & '"' & @CRLF & _
    '$jobs = foreach ($computer in $computers) {' & @CRLF & _
    ' if ($computer -ne $env:COMPUTERNAME) {' & @CRLF & _
    ' $psexecArgs = "-u $username -p $password \\" + $computer + "' & $parameter & '" + $batchFilePath' & @CRLF & _
    ' Start-Job -ScriptBlock {' & @CRLF & _
    ' param($psexecCommand, $psexecArgs)' & @CRLF & _
    ' Start-Process -FilePath $psexecCommand -ArgumentList $psexecArgs -NoNewWindow -Wait' & @CRLF & _
    ' } -ArgumentList $psexecCommand, $psexecArgs' & @CRLF & _
    ' }' & @CRLF & _
    '}' & @CRLF & _
    '$null = Wait-Job -Job $jobs' & @CRLF & _
    '$jobs | Remove-Job'
    
    FileWrite($psScriptPath, $psScriptContent)
    RunWait(@ComSpec & ' /c powershell.exe -ExecutionPolicy Bypass -File "' & $psScriptPath & '"', "", @SW_HIDE)
    MsgBox(64, "Info", "Jobs wurden erfolgreich ausgeführt.")
    FileDelete($psScriptPath)
    EndFunc
    Alles anzeigen


    lg und danke noch mal für die Mithilfe

  • parameter parsen mit Leerzeichen im Pfad

    • casi4712
    • 3. Juni 2024 um 10:54
    AutoIt
    jo danke erst einmal für Euer Feedback, also das generierte Script was im Normalfall funktioniert sieht wie folgt aus, as sollte dann ja nur nach den Parametern, hier -i , sattt dem Powershell der Pfad von vlv drin stehen, möglicherweise ist es ein Problem von Powershell:
    Code
    $hostFilePath = "C:\Users\Riegert\Desktop\construction\lists\host3.txt"
    $computers = Get-Content -Path $hostFilePath
    $username = "Administrator"
    $password = "passwort"
    $securePassword = ConvertTo-SecureString $password -AsPlainText -Force
    $credential = New-Object System.Management.Automation.PSCredential($username, $securePassword)
    $batchFilePath = "\\Fusselbox\Fusselbox\Scripts\Inventory-Network.ps1"
    $psexecCommand = "C:\windows\psexec.exe"
    $jobs = foreach ($computer in $computers) {
        if ($computer -ne $env:COMPUTERNAME) {
            $psexecArgs = "-u $username -p $password \\" + $computer + " -i powershell -NoProfile -ExecutionPolicy Bypass -File " + $batchFilePath
            Start-Job -ScriptBlock {
                param($psexecCommand, $psexecArgs)
                Start-Process -FilePath $psexecCommand -ArgumentList $psexecArgs -NoNewWindow -Wait
            } -ArgumentList $psexecCommand, $psexecArgs
        }
    }
    $null = Wait-Job -Job $jobs
    
    
    $jobs | Remove-Job
    Alles anzeigen


    mit mp3 option und intigrierten Playerprogramm:


    Code
    $hostFilePath = "C:\Users\Riegert\Desktop\construction\lists\host3.txt"
    $computers = Get-Content -Path $hostFilePath
    $username = "Administrator"
    $password = "passwort"
    $securePassword = ConvertTo-SecureString $password -AsPlainText -Force
    $credential = New-Object System.Management.Automation.PSCredential($username, $securePassword)
    $batchFilePath = "\\Fusselbox\Fusselbox\Scripts\tuer.mp3"
    $psexecCommand = "C:\windows\psexec.exe"
    $jobs = foreach ($computer in $computers) {
        if ($computer -ne $env:COMPUTERNAME) {
            $psexecArgs = "-u $username -p $password \\" + $computer + " -i "c:\Program Files\VideoLAN\VLC\vlc.exe" -Idummy" + $batchFilePath
            Start-Job -ScriptBlock {
                param($psexecCommand, $psexecArgs)
                Start-Process -FilePath $psexecCommand -ArgumentList $psexecArgs -NoNewWindow -Wait
            } -ArgumentList $psexecCommand, $psexecArgs
        }
    }
    $null = Wait-Job -Job $jobs
    $jobs | Remove-Job
    Alles anzeigen


    Der Befehl der als Einzelbefehl geht ist folgender, an der Reihenfolge ist da aber grundsätzlich nichts anders:

    $command = '"' & $PsExecPath & '" -d -i -s \\' & $Computer & ' -u ' & $Username & ' -p "' & $Password & '" "' & $Player & '" -Idummy "' & $file & '"'

    lg und schöne Woche noch

  • parameter parsen mit Leerzeichen im Pfad

    • casi4712
    • 3. Juni 2024 um 01:41

    Hallo und danke erst einmal, du meintest es so:


    Local $splayer = """c:\Program Files\VideoLAN\VLC\vlc.exe"""

    Leider passiert wieder nichts,

  • parameter parsen mit Leerzeichen im Pfad

    • casi4712
    • 2. Juni 2024 um 23:05

    ok dann formulier ich es mal ausführlicher, es gibt 2 Funktionen, eine die PSEXEC Parameter generiert und eine die ein Powershell Script ausführt: Die restlichen Dateitypen funktionieren alle, nur dass mit JPG und mp3 macht probleme wegen den "" vermute ich mal:

    AutoIt
    Func GetExecutionParameter($filePath)
        ; PSEXEC Parameter
        Local $params = ""
        Local $viewer = 'C:\Program Files (x86)\Google\Picasa3\PicasaPhotoViewer.exe'
        Local $splayer = 'c:\Program Files\VideoLAN\VLC\vlc.exe'
        
        If BitAND(GUICtrlRead($check_c), $GUI_CHECKED) Then $params &= " -f -c"
        If BitAND(GUICtrlRead($check_i), $GUI_CHECKED) Then $params &= " -i"
        If BitAND(GUICtrlRead($check_h), $GUI_CHECKED) Then $params &= " -h"
        If BitAND(GUICtrlRead($check_l), $GUI_CHECKED) Then $params &= " -l"
        If BitAND(GUICtrlRead($check_e), $GUI_CHECKED) Then $params &= " -e"
        If BitAND(GUICtrlRead($check_s), $GUI_CHECKED) Then $params &= " -s"
        If BitAND(GUICtrlRead($check_x), $GUI_CHECKED) Then $params &= " -x"
        If BitAND(GUICtrlRead($check_v), $GUI_CHECKED) Then $params &= " -v"
        If BitAND(GUICtrlRead($check_d), $GUI_CHECKED) Then $params &= " -d"
    
        If StringRight($filePath, 4) = ".ps1" Then
            Return $params & ' powershell -NoProfile -ExecutionPolicy Bypass -File '
        ElseIf StringRight($filePath, 4) = ".bat" Then
            Return $params & ' -i cmd /c '
        ElseIf StringRight($filePath, 4) = ".cmd" Then
            Return $params & ' -i cmd /c '
        ElseIf StringRight($filePath, 4) = ".exe" Then
            Return $params & ' -i '
        ElseIf StringRight($filePath, 4) = ".vbs" Then
            Return $params & ' cscript.exe '
        ElseIf StringRight($filePath, 4) = ".jpg" Then
    			Return $params & ' start "" '
    	ElseIf StringRight($filePath, 4) = ".mp3" Then ;Audiofile
           Return $params & ' "' & $splayer & '" -Idummy'
    
        Else
            Return $params & ' cmd /c '
        EndIf
    EndFunc
    
    Func ExecuteParallelBatch($batchFilePath)
        Global $username, $password, $PsExecPath, $hostFilePath
        Local $psScriptPath = @TempDir & "\temp_script.ps1"
        Local $psexecArgs
        Local $psScriptContent
    	Local $player = "C:\Program Files (x86)\Google\Picasa3\PicasaPhotoViewer.exe"
        Local $splayer = 'c:\Program Files\VideoLAN\VLC\vlc.exe'
        ; Bestimme den Parameter für den Ausführungstyp basierend auf der Dateiendung
        Local $parameter = GetExecutionParameter($batchFilePath)
    MsgBox(64, "Info", $Parameter)
        ; Powershell-Skript für parallele Jobausführung
        $psScriptContent = '$hostFilePath = "' & $hostFilePath & '"' & @CRLF & _
            '$computers = Get-Content -Path $hostFilePath' & @CRLF & _
            '$username = "' & $username & '"' & @CRLF & _
            '$password = "' & $password & '"' & @CRLF & _
            '$securePassword = ConvertTo-SecureString $password -AsPlainText -Force' & @CRLF & _
            '$credential = New-Object System.Management.Automation.PSCredential($username, $securePassword)' & @CRLF & _
            '$batchFilePath = "' & $batchFilePath & '"' & @CRLF & _
            '$psexecCommand = "' & $PsExecPath & '"' & @CRLF & _
            '$jobs = foreach ($computer in $computers) {' & @CRLF & _
            '    if ($computer -ne $env:COMPUTERNAME) {' & @CRLF & _
            '        $psexecArgs = "-u $username -p $password \\" + $computer + "' & $parameter & '" + $batchFilePath' & @CRLF & _
            '        Start-Job -ScriptBlock {' & @CRLF & _
            '            param($psexecCommand, $psexecArgs)' & @CRLF & _
            '            Start-Process -FilePath $psexecCommand -ArgumentList $psexecArgs -NoNewWindow -Wait' & @CRLF & _
            '        } -ArgumentList $psexecCommand, $psexecArgs' & @CRLF & _
            '    }' & @CRLF & _
            '}' & @CRLF & _
            '$null = Wait-Job -Job $jobs' & @CRLF & _
            '$jobs | Remove-Job'
    
        FileWrite($psScriptPath, $psScriptContent)
        RunWait(@ComSpec & ' /c powershell.exe -ExecutionPolicy Bypass -File "' & $psScriptPath & '"', "", @SW_HIDE)
        MsgBox(64, "Info", "Jobs wurden erfolgreich ausgeführt.")
        FileDelete($psScriptPath)
    EndFunc
    Alles anzeigen

    lg und eine schöne Woche

  • parameter parsen mit Leerzeichen im Pfad

    • casi4712
    • 2. Juni 2024 um 15:06

    Hallo an alle, insbesindere unsere Syntax Experten. Wie muss man es anstellen um einen Filenamen mit Leerzeichen in der Args Zeile einzufügen, ich hatte es auch schon mit "'" pfad "'" versucht hat auch nichts geholfen, sofern das Programm ohne Leerzeuchen ist funktioneirt es.

    AutoIt
    Func GetExecutionParameter($filePath)
    .
    .
     ElseIf StringRight($filePath, 4) = ".jpg" Then
      Return $params = ' -s -i -d "Path\with spaces\Viewer.exe" '
    .
    EndFunc
    
    Func ExecuteParallelBatch($batchFilePath)
       Local $parameter = GetExecutionParameter($batchFilePath)
    .
    .
    $psScriptContent = '$hostFilePath = "' & $hostFilePath & '"' & @CRLF & _
        .
    .
    .
    .
        '      $psexecArgs = "-u $username -p $password \\" + $computer + " ' & $parameter & ' \\"" + $batchFilePath + "\\""' & @CRLF & _
        '
    .
    .
    .
    EndFunc
    Alles anzeigen


    Recht herzlichen Dank schonmal


    lg und schönen Sonntag noch

  • eingebundenes Powershell macht plötzlich Probleme

    • casi4712
    • 1. Juni 2024 um 00:48

    okidoki werde mich da mal sachschlau machen, recht herzlichen dank.


    lg und schönes Wocheende

  • eingebundenes Powershell macht plötzlich Probleme

    • casi4712
    • 31. Mai 2024 um 21:32

    oj sorry stimmt, kA warum ich jett das genommen hatte, dachte wär das selbe, wie würde das denn mit der neuen aussehen,? Und kannd as die Bezeichnung aus dem AD auslesen?


    lg und schönes WE

  • eingebundenes Powershell macht plötzlich Probleme

    • casi4712
    • 30. Mai 2024 um 19:03

    Gut ich merke schon, sind nicht viele Powershell Freunde hier, is nur schade da ich halt noch einige nützliche PS Scripte habe, und warum das Rad neu erfinden. Ok dann versuchen wir es halt wie emfohlen, bin ja noch halbwegs formbar, trotz meines hohen Alters. So Frage: wie kann ich aus dem AD die Beschreibung spalte auslsen, ich bekomme da immer nur Array[1] zu lesen.

    AutoIt
    #include <ADfunctions.au3>
    #include <Array.au3>
    
    ; Globale Variable für Computer
    Global $aComputers
    $sOU = $strDNSDomain
    
    ; AD-Abfrage, um nur Computer zu holen, deren Name mit "A" oder "N" beginnt
    _ADGetObjectsInOU($aComputers, $sOU, "(&(objectclass=computer)(|(name=A*)(name=N*)))", 2, "name,operatingSystem,description")
    
    ; Ausgabe der gefundenen Computer
    _ArrayDisplay($aComputers)
    Alles anzeigen

    lg und schönen Abend noch

  • Guielemente im Array

    • casi4712
    • 29. Mai 2024 um 11:31

    Oj e, recht herzlichen Dank erstmal, aber ich denke dass ist in meinem konkreten Fall mit Kanonnen auf Spatzen geschossen. Meine Intention war ja mit der Methode eher Codezeilen einzusparen und die Übersichtlichkeit zu erhöhen, ich finde die ist doch gegeben, zumindest wenn man gleichartige Elemente im Array direkt untereinander schreibt. Gut möglich das mit meiner Methode nicht alle Spezialfällte berückstichtigt werden. Das einzige Problem was meine Methode hat dass die im Array stehenden Ids nicht als Variable initiert werden und somit nicht in weiteren Funktionen nutzbar sind:

    AutoIt
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <Array.au3>
    
    Global $Button1, $Edit1, $ComputerList, $fileName
    Global $hostFilePath
    
    Opt("GUIOnEventMode", 1)
    
    Global $arElements = [ _
        [0, "Button1", "Button", "Save and choose file", 190, 340, 160, 30, "Liste speichern und File ausführen", "", ""], _
        [0, "SaveButton", "Button", "Save List", 10, 340, 100, 30, "Liste speichern", "", ""], _
        [0, "SwitchButton1", "Button", "Host1", 210, 30, 70, 30, "nd", "", ""], _
        [0, "SwitchButton2", "Button", "Host2", 210, 70, 70, 30, "nd", "", ""], _
        [0, "SwitchButton3", "Button", "Workgroup", 210, 110, 70, 30, "nd", "", ""], _
        [0, "SwitchButton4", "Button", "Fritz", 280, 30, 70, 30, "nd", "", ""], _
        [0, "SwitchButton5", "Button", "IT-Service", 280, 70, 70, 30, "nd", "", ""], _
        [0, "SwitchButton6", "Button", "Lesesaal", 280, 110, 70, 30, "nd", "", ""], _
        [0, "AllDomPCButton", "Button", "AllDomPC", 210, 170, 70, 30, "sdsds", "", ""], _
        [0, "AllDomPCsWithAButton", "Button", "Alle PC", 280, 170, 70, 30, "sdsds", "", ""], _
        [0, "AllServerButton", "Button", "All Server", 280, 200, 70, 30, "sdsds", "", ""], _
        [0, "AllLapButton", "Button", "All Laptop", 210, 200, 70, 30, "sdsds", "", ""], _
        [0, "AugiasPCButton", "Button", "All AugiasPC", 210, 230, 70, 30, "sdsds", "", ""], _
        [0, "Checkbox1", "Checkbox", "AdminUser", 10, 390, 90, 20, "", $GUI_CHECKED, ">>>"], _
        [0, "Checkbox2", "Checkbox", "Interactive", 100, 390, 90, 20, "", $GUI_UNCHECKED, ">>>"], _
        [0, "Checkbox3", "Checkbox", "CopyFile", 200, 390, 90, 20, "", $GUI_UNCHECKED, ">>>"], _
        [0, "Label1", "Label", "Freie Listen", 210, 10, 100, 20, "", "", "9,800,800"], _
        [0, "HostsLabel", "Label", "DC-Filter", 210, 150, 70, 20, "", "", "9,800,800"], _
        [0, "DCFilterLabel", "Label", "Actions", 210, 290, 70, 20, "", "", "9,800,800"], _
        [0, "OtherUserLabel", "Label", "", 10, 312, 80, 20, "", "", ""], _
        [0, "StatusLabel", "Label", "other User", 10, 312, 80, 20, "", "", ""], _
        [0, "GearIcon", "Icon", "shell32.dll", 172, 280, 385, 30, 30, "Öffnet das aktuelle Skriptverzeichnis im Explorer", "", ""], _
        [0, "PrefIcon", "Icon", "shell32.dll", 16826, 320, 390, 25, 25, "Öffnet die Settings", "", ""], _
        [0, "ActionCombo", "Combo", "InstallActaPro|DelActaPro|-----------------------|Fun2|hdl|leise|laut|play", 210, 310, 140, 25, "", "", ""], _
        [0, "Edit1", "Edit", "", 10, 30, 190, 270, "", "", ""], _
        [0, "RadioGroupStart", "Group", "", 10, 450, 160, 15, "", "", "", $GUI_ENABLE], _  ; Start der Radio-Button-Gruppe
        [0, "RadioButton1", "Radio", "Option 1", 10, 450, 60, 10, "", "", "", $GUI_ENABLE + $GUI_CHECKED], _
        [0, "RadioButton2", "Radio", "Option 2", 110, 450, 60, 10, "", "", "", $GUI_ENABLE], _
        [0, "RadioGroupEnd", "GroupEnd", "", 0, 0, 0, 0, "", "", ""], _  ; Ende der Radio-Button-Gruppe
        [0, "Input1", "Input", "", 10, 370, 90, 20, "", "", "", $GUI_ENABLE] _
    ]
    
    Global $hParent = GUICreate("TESTGUI", 360, 520)
    _CreateGuiElement($arElements)
    
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
    GUISetState(@SW_SHOW, $hParent)
    
    While 1
        Sleep(10)
    WEnd
    
    Func _HandleCtrlEvent()
        Local $iIndex = _ArraySearch($arElements, @GUI_CtrlId, 0, 0, 0, 0, 1, 0)
    
        Switch $arElements[$iIndex][1]
            Case "SwitchButton1"
                LoadHostFile("host1.txt")
    
        EndSwitch
    EndFunc
    
    
    
    Func LoadHostFile($fileName)
    
        $hostFilePath = @ScriptDir & "\lists\" & $fileName
        $ComputerList = FileRead($hostFilePath)
        GUICtrlSetData($Edit1, $ComputerList)
    
    EndFunc
    
    
    Func _Exit()
        Exit
    EndFunc
    
    Func _CreateGuiElement(ByRef $aCtrlInfo)
        For $i = 0 To UBound($aCtrlInfo) - 1
            Switch $aCtrlInfo[$i][2]
                Case "Button"
                    $aCtrlInfo[$i][0] = GUICtrlCreateButton($aCtrlInfo[$i][3], $aCtrlInfo[$i][4], $aCtrlInfo[$i][5], $aCtrlInfo[$i][6], $aCtrlInfo[$i][7])
                    GUICtrlSetTip(-1, $aCtrlInfo[$i][8])
                Case "Checkbox"
                    $aCtrlInfo[$i][0] = GUICtrlCreateCheckbox($aCtrlInfo[$i][3], $aCtrlInfo[$i][4], $aCtrlInfo[$i][5], $aCtrlInfo[$i][6])
                    GUICtrlSetState(-1, $aCtrlInfo[$i][9])
                Case "Label"
                    $aCtrlInfo[$i][0] = GUICtrlCreateLabel($aCtrlInfo[$i][3], $aCtrlInfo[$i][4], $aCtrlInfo[$i][5], $aCtrlInfo[$i][6])
                    If $aCtrlInfo[$i][10] <> "" Then
                        Local $fontParams = StringSplit($aCtrlInfo[$i][10], ",")
                        GUICtrlSetFont(-1, $fontParams[1], $fontParams[2], $fontParams[3])
                    EndIf
                Case "Icon"
                    $aCtrlInfo[$i][0] = GUICtrlCreateIcon($aCtrlInfo[$i][3], $aCtrlInfo[$i][4], $aCtrlInfo[$i][5], $aCtrlInfo[$i][6], $aCtrlInfo[$i][7], $aCtrlInfo[$i][8])
                    GUICtrlSetTip(-1, $aCtrlInfo[$i][9])
                Case "Combo"
                    $aCtrlInfo[$i][0] = GUICtrlCreateCombo("", $aCtrlInfo[$i][4], $aCtrlInfo[$i][5], $aCtrlInfo[$i][6], $aCtrlInfo[$i][7])
                    GUICtrlSetData($aCtrlInfo[$i][0], $aCtrlInfo[$i][3])
                Case "Edit"
                    $aCtrlInfo[$i][0] = GUICtrlCreateEdit($aCtrlInfo[$i][3], $aCtrlInfo[$i][4], $aCtrlInfo[$i][5], $aCtrlInfo[$i][6], $aCtrlInfo[$i][7])
                Case "Radio"
                    $aCtrlInfo[$i][0] = GUICtrlCreateRadio($aCtrlInfo[$i][3], $aCtrlInfo[$i][4], $aCtrlInfo[$i][5], $aCtrlInfo[$i][6], $aCtrlInfo[$i][7])
                    GUICtrlSetState($aCtrlInfo[$i][0], $aCtrlInfo[$i][11]) ; Setzt den Radiobutton in den angegebenen Zustand
                Case "Input"
                    $aCtrlInfo[$i][0] = GUICtrlCreateInput($aCtrlInfo[$i][3], $aCtrlInfo[$i][4], $aCtrlInfo[$i][5], $aCtrlInfo[$i][6], $aCtrlInfo[$i][7])
                Case "Group"
                    $aCtrlInfo[$i][0] = GUICtrlCreateGroup("", $aCtrlInfo[$i][4], $aCtrlInfo[$i][5], $aCtrlInfo[$i][6], $aCtrlInfo[$i][7])
                Case "GroupEnd"
                    GUICtrlCreateGroup("", -99, -99, 1, 1)  ; End Group
            EndSwitch
            GUICtrlSetOnEvent(-1, "_HandleCtrlEvent")
        Next
    EndFunc
    Alles anzeigen

    das würde mir fürs erste reichen,

    lg und schöne Reatwoche noch

  • Guielemente im Array

    • casi4712
    • 29. Mai 2024 um 01:55

    ich bin vielleicht ein Honk, und du sagt es noch mit den Überschneidungen, dachte mir erst nix dabei, aber das war wohl das Problem. Leider hab ich es nur über eine Krücke hinbekommen mit den Zeilen groupstart und ende.

    AutoIt
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <Array.au3>
    
    Global $Button1
    
    Opt("GUIOnEventMode", 1)
    
    Global $arElements = [ _
        [0, "Button1", "Button", "Save and choose file", 190, 340, 160, 30, "Liste speichern und File ausführen", "", ""], _
        [0, "SaveButton", "Button", "Save List", 10, 340, 100, 30, "Liste speichern", "", ""], _
        [0, "SwitchButton1", "Button", "Host1", 210, 30, 70, 30, "nd", "", ""], _
        [0, "SwitchButton2", "Button", "Host2", 210, 70, 70, 30, "nd", "", ""], _
        [0, "SwitchButton3", "Button", "Workgroup", 210, 110, 70, 30, "nd", "", ""], _
        [0, "SwitchButton4", "Button", "Fritz", 280, 30, 70, 30, "nd", "", ""], _
        [0, "SwitchButton5", "Button", "IT-Service", 280, 70, 70, 30, "nd", "", ""], _
        [0, "SwitchButton6", "Button", "Lesesaal", 280, 110, 70, 30, "nd", "", ""], _
        [0, "AllDomPCButton", "Button", "AllDomPC", 210, 170, 70, 30, "sdsds", "", ""], _
        [0, "AllDomPCsWithAButton", "Button", "Alle PC", 280, 170, 70, 30, "sdsds", "", ""], _
        [0, "AllServerButton", "Button", "All Server", 280, 200, 70, 30, "sdsds", "", ""], _
        [0, "AllLapButton", "Button", "All Laptop", 210, 200, 70, 30, "sdsds", "", ""], _
        [0, "AugiasPCButton", "Button", "All AugiasPC", 210, 230, 70, 30, "sdsds", "", ""], _
        [0, "Checkbox1", "Checkbox", "AdminUser", 10, 390, 90, 20, "", $GUI_CHECKED, ">>>"], _
        [0, "Checkbox2", "Checkbox", "Interactive", 100, 390, 90, 20, "", $GUI_UNCHECKED, ">>>"], _
        [0, "Checkbox3", "Checkbox", "CopyFile", 200, 390, 90, 20, "", $GUI_UNCHECKED, ">>>"], _
        [0, "Label1", "Label", "Freie Listen", 210, 10, 100, 20, "", "", "9,800,800"], _
        [0, "HostsLabel", "Label", "DC-Filter", 210, 150, 70, 20, "", "", "9,800,800"], _
        [0, "DCFilterLabel", "Label", "Actions", 210, 290, 70, 20, "", "", "9,800,800"], _
        [0, "OtherUserLabel", "Label", "", 10, 312, 80, 20, "", "", ""], _
        [0, "StatusLabel", "Label", "other User", 10, 312, 80, 20, "", "", ""], _
        [0, "GearIcon", "Icon", "shell32.dll", 172, 280, 385, 30, 30, "Öffnet das aktuelle Skriptverzeichnis im Explorer", "", ""], _
        [0, "PrefIcon", "Icon", "shell32.dll", 16826, 320, 390, 25, 25, "Öffnet die Settings", "", ""], _
        [0, "ActionCombo", "Combo", "InstallActaPro|DelActaPro|-----------------------|Fun2|hdl|leise|laut|play", 210, 310, 140, 25, "", "", ""], _
        [0, "Edit1", "Edit", "", 10, 30, 190, 270, "", "", ""], _
        [0, "RadioGroupStart", "Group", "", 10, 450, 160, 15, "", "", "", $GUI_ENABLE], _  ; Start der Radio-Button-Gruppe
        [0, "RadioButton1", "Radio", "Option 1", 10, 450, 60, 10, "", "", "", $GUI_ENABLE + $GUI_CHECKED], _
        [0, "RadioButton2", "Radio", "Option 2", 110, 450, 60, 10, "", "", "", $GUI_ENABLE], _
        [0, "RadioGroupEnd", "GroupEnd", "", 0, 0, 0, 0, "", "", ""], _  ; Ende der Radio-Button-Gruppe
        [0, "Input1", "Input", "", 10, 370, 90, 20, "", "", "", $GUI_ENABLE] _
    ]
    
    Global $hParent = GUICreate("TESTGUI", 360, 520)
    _CreateGuiElement($arElements)
    
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
    GUISetState(@SW_SHOW, $hParent)
    
    While 1
        Sleep(10)
    WEnd
    
    Func _HandleCtrlEvent()
        Local $iIndex = _ArraySearch($arElements, @GUI_CtrlId, 0, 0, 0, 0, 1, 0)
    
        Switch $arElements[$iIndex][1]
            Case "SwitchButton1"
                MsgBox($MB_OK, "Button Clicked", "Host1")
            Case "SwitchButton2"
                MsgBox($MB_OK, "Button Clicked", "Host2")
        EndSwitch
    EndFunc
    
    
    
    
    Func _Exit()
        Exit
    EndFunc
    
    Func _CreateGuiElement(ByRef $aCtrlInfo)
        For $i = 0 To UBound($aCtrlInfo) - 1
            Switch $aCtrlInfo[$i][2]
                Case "Button"
                    $aCtrlInfo[$i][0] = GUICtrlCreateButton($aCtrlInfo[$i][3], $aCtrlInfo[$i][4], $aCtrlInfo[$i][5], $aCtrlInfo[$i][6], $aCtrlInfo[$i][7])
                    GUICtrlSetTip(-1, $aCtrlInfo[$i][8])
                Case "Checkbox"
                    $aCtrlInfo[$i][0] = GUICtrlCreateCheckbox($aCtrlInfo[$i][3], $aCtrlInfo[$i][4], $aCtrlInfo[$i][5], $aCtrlInfo[$i][6])
                    GUICtrlSetState(-1, $aCtrlInfo[$i][9])
                Case "Label"
                    $aCtrlInfo[$i][0] = GUICtrlCreateLabel($aCtrlInfo[$i][3], $aCtrlInfo[$i][4], $aCtrlInfo[$i][5], $aCtrlInfo[$i][6])
                    If $aCtrlInfo[$i][10] <> "" Then
                        Local $fontParams = StringSplit($aCtrlInfo[$i][10], ",")
                        GUICtrlSetFont(-1, $fontParams[1], $fontParams[2], $fontParams[3])
                    EndIf
                Case "Icon"
                    $aCtrlInfo[$i][0] = GUICtrlCreateIcon($aCtrlInfo[$i][3], $aCtrlInfo[$i][4], $aCtrlInfo[$i][5], $aCtrlInfo[$i][6], $aCtrlInfo[$i][7], $aCtrlInfo[$i][8])
                    GUICtrlSetTip(-1, $aCtrlInfo[$i][9])
                Case "Combo"
                    $aCtrlInfo[$i][0] = GUICtrlCreateCombo("", $aCtrlInfo[$i][4], $aCtrlInfo[$i][5], $aCtrlInfo[$i][6], $aCtrlInfo[$i][7])
                    GUICtrlSetData($aCtrlInfo[$i][0], $aCtrlInfo[$i][3])
                Case "Edit"
                    $aCtrlInfo[$i][0] = GUICtrlCreateEdit($aCtrlInfo[$i][3], $aCtrlInfo[$i][4], $aCtrlInfo[$i][5], $aCtrlInfo[$i][6], $aCtrlInfo[$i][7])
                Case "Radio"
                    $aCtrlInfo[$i][0] = GUICtrlCreateRadio($aCtrlInfo[$i][3], $aCtrlInfo[$i][4], $aCtrlInfo[$i][5], $aCtrlInfo[$i][6], $aCtrlInfo[$i][7])
                    GUICtrlSetState($aCtrlInfo[$i][0], $aCtrlInfo[$i][11]) ; Setzt den Radiobutton in den angegebenen Zustand
                Case "Input"
                    $aCtrlInfo[$i][0] = GUICtrlCreateInput($aCtrlInfo[$i][3], $aCtrlInfo[$i][4], $aCtrlInfo[$i][5], $aCtrlInfo[$i][6], $aCtrlInfo[$i][7])
                Case "Group"
                    $aCtrlInfo[$i][0] = GUICtrlCreateGroup("", $aCtrlInfo[$i][4], $aCtrlInfo[$i][5], $aCtrlInfo[$i][6], $aCtrlInfo[$i][7])
                Case "GroupEnd"
                    GUICtrlCreateGroup("", -99, -99, 1, 1)  ; End Group
            EndSwitch
            GUICtrlSetOnEvent(-1, "_HandleCtrlEvent")
        Next
    EndFunc
    Alles anzeigen

    LG

  • Guielemente im Array

    • casi4712
    • 28. Mai 2024 um 22:17

    ok habs jetzt raus, die entsprechende Array zeile sollte wie folgt sein:


    AutoIt
        [0, "RadioButton1", "Radio", "Option 1", 10, 310, 90, 20, "", "", "", $GUI_ENABLE + $GUI_CHECKED + $GUI_DEFBUTTON + $GUI_ONTOP + $GUI_DROPACCEPTED + $GUI_UNCHECKED + $GUI_HIDE + $GUI_SHOW  ], _

    aber das is wohl eher zufall, ich sehe grade ich brauch dann wohl noch ein neues element um die Gruppe zu defineiren

    lg und schönen Abend

  • Guielemente im Array

    • casi4712
    • 28. Mai 2024 um 21:49

    ja aber die beiden Radios kann ich nicht wechseln, das ist das Problem;)

  • Guielemente im Array

    • casi4712
    • 28. Mai 2024 um 20:06

    also ich war noch mal aktiv und hab das ganze noch um ein paar GUI elemente erweitert, aber bei Radiobuttons kommt es zu einem Problem, cant initialize variable with itsself, was hab ich denn hier hier wieder übersehen;)? Habe Deinen Ansatz fortgeführt


    AutoIt
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <Array.au3>
    
    Global $Button1
    
    Opt("GUIOnEventMode", 1)
    
    Global $arElements = [ _
        [0, "Button1", "Button", "Save and choose file", 190, 340, 160, 30, "Liste speichern und File ausführen", "", ""], _
        [0, "SaveButton", "Button", "Save List", 10, 340, 100, 30, "Liste speichern", "", ""], _
        [0, "SwitchButton1", "Button", "Host1", 210, 30, 70, 30, "nd", "", ""], _
        [0, "SwitchButton2", "Button", "Host2", 210, 70, 70, 30, "nd", "", ""], _
        [0, "SwitchButton3", "Button", "Workgroup", 210, 110, 70, 30, "nd", "", ""], _
        [0, "SwitchButton4", "Button", "Fritz", 280, 30, 70, 30, "nd", "", ""], _
        [0, "SwitchButton5", "Button", "IT-Service", 280, 70, 70, 30, "nd", "", ""], _
        [0, "SwitchButton6", "Button", "Lesesaal", 280, 110, 70, 30, "nd", "", ""], _
        [0, "AllDomPCButton", "Button", "AllDomPC", 210, 170, 70, 30, "sdsds", "", ""], _
        [0, "AllDomPCsWithAButton", "Button", "Alle PC", 280, 170, 70, 30, "sdsds", "", ""], _
        [0, "AllServerButton", "Button", "All Server", 280, 200, 70, 30, "sdsds", "", ""], _
        [0, "AllLapButton", "Button", "All Laptop", 210, 200, 70, 30, "sdsds", "", ""], _
        [0, "AugiasPCButton", "Button", "All AugiasPC", 210, 230, 70, 30, "sdsds", "", ""], _
        [0, "Checkbox1", "Checkbox", "AdminUser", 10, 390, 90, 20, "", $GUI_CHECKED, ">>>"], _
        [0, "Checkbox2", "Checkbox", "Interactive", 100, 390, 90, 20, "", $GUI_UNCHECKED, ">>>"], _
        [0, "Checkbox3", "Checkbox", "CopyFile", 200, 390, 90, 20, "", $GUI_UNCHECKED, ">>>"], _
        [0, "Label1", "Label", "Freie Listen", 210, 10, 100, 20, "", "", "9,800,800"], _
        [0, "HostsLabel", "Label", "DC-Filter", 210, 150, 70, 20, "", "", "9,800,800"], _
        [0, "DCFilterLabel", "Label", "Actions", 210, 290, 70, 20, "", "", "9,800,800"], _
        [0, "OtherUserLabel", "Label", "", 10, 312, 80, 20, "", "", ""], _
        [0, "StatusLabel", "Label", "other User", 10, 312, 80, 20, "", "", ""], _
        [0, "GearIcon", "Icon", "shell32.dll", 172, 280, 385, 30, 30, "Öffnet das aktuelle Skriptverzeichnis im Explorer", "", ""], _
        [0, "PrefIcon", "Icon", "shell32.dll", 16826, 320, 390, 25, 25, "Öffnet die Settings", "", ""], _
        [0, "ActionCombo", "Combo", "InstallActaPro|DelActaPro|-----------------------|Fun2|hdl|leise|laut|play", 210, 310, 140, 25, "", "", ""], _
        [0, "Edit1", "Edit", "", 10, 30, 190, 270, "", "", ""], _
        [0, "RadioButton1", "Radio", "Option 1", 10, 310, 90, 20, "", "", "", $GUI_ENABLE + $GUI_CHECKED], _
        [0, "RadioButton2", "Radio", "Option 2", 110, 310, 90, 20, "", "", "", $GUI_ENABLE], _
        [0, "Input1", "Input", "", 10, 350, 90, 20, "", "", "", $GUI_ENABLE] _
    ]
    
    Global $hParent = GUICreate("TESTGUI", 360, 420)
    _CreateGuiElement($arElements)
    
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
    GUISetState(@SW_SHOW, $hParent)
    
    While 1
        Sleep(10)
    WEnd
    
    Func _HandleCtrlEvent()
        Local $iIndex = _ArraySearch($arElements, @GUI_CtrlId, 0, 0, 0, 0, 1, 0)
    
        Switch $arElements[$iIndex][1]
            Case "SwitchButton1"
                MsgBox($MB_OK, "Button Clicked", "Host1")
            Case "SwitchButton2"
                MsgBox($MB_OK, "Button Clicked", "Host2")
        EndSwitch
    EndFunc
    
    Func _Exit()
        Exit
    EndFunc
    
    Func _CreateGuiElement(ByRef $aCtrlInfo)
        Local $hRadioGroup
        For $i = 0 To UBound($aCtrlInfo) - 1
            Switch $aCtrlInfo[$i][2]
                Case "Button"
                    $aCtrlInfo[$i][0] = GUICtrlCreateButton($aCtrlInfo[$i][3], $aCtrlInfo[$i][4], $aCtrlInfo[$i][5], $aCtrlInfo[$i][6], $aCtrlInfo[$i][7])
                    GUICtrlSetTip(-1, $aCtrlInfo[$i][8])
                Case "Checkbox"
                    $aCtrlInfo[$i][0] = GUICtrlCreateCheckbox($aCtrlInfo[$i][3], $aCtrlInfo[$i][4], $aCtrlInfo[$i][5], $aCtrlInfo[$i][6])
                    GUICtrlSetState(-1, $aCtrlInfo[$i][9])
                Case "Label"
                    $aCtrlInfo[$i][0] = GUICtrlCreateLabel($aCtrlInfo[$i][3], $aCtrlInfo[$i][4], $aCtrlInfo[$i][5], $aCtrlInfo[$i][6])
                    If $aCtrlInfo[$i][10] <> "" Then
                        Local $fontParams = StringSplit($aCtrlInfo[$i][10], ",")
                        GUICtrlSetFont(-1, $fontParams[1], $fontParams[2], $fontParams[3])
                    EndIf
                Case "Icon"
                    $aCtrlInfo[$i][0] = GUICtrlCreateIcon($aCtrlInfo[$i][3], $aCtrlInfo[$i][4], $aCtrlInfo[$i][5], $aCtrlInfo[$i][6], $aCtrlInfo[$i][7], $aCtrlInfo[$i][8])
                    GUICtrlSetTip(-1, $aCtrlInfo[$i][9])
                Case "Combo"
                    $aCtrlInfo[$i][0] = GUICtrlCreateCombo("", $aCtrlInfo[$i][4], $aCtrlInfo[$i][5], $aCtrlInfo[$i][6], $aCtrlInfo[$i][7])
                    GUICtrlSetData($aCtrlInfo[$i][0], $aCtrlInfo[$i][3])
                Case "Edit"
                    $aCtrlInfo[$i][0] = GUICtrlCreateEdit($aCtrlInfo[$i][3], $aCtrlInfo[$i][4], $aCtrlInfo[$i][5], $aCtrlInfo[$i][6], $aCtrlInfo[$i][7])
                Case "Radio"
                    If Not IsDeclared("hRadioGroup") Then
                        $hRadioGroup = GUICtrlCreateGroup("", $aCtrlInfo[$i][4] - 5, $aCtrlInfo[$i][5] - 5, 200, 50)
                    EndIf
                    $aCtrlInfo[$i][0] = GUICtrlCreateRadio($aCtrlInfo[$i][3], $aCtrlInfo[$i][4], $aCtrlInfo[$i][5], $aCtrlInfo[$i][6], $aCtrlInfo[$i][7])
                    GUICtrlSetState(-1, $aCtrlInfo[$i][11])
                    GUICtrlSetTip(-1, $aCtrlInfo[$i][8])
                Case "Input"
                    $aCtrlInfo[$i][0] = GUICtrlCreateInput($aCtrlInfo[$i][3], $aCtrlInfo[$i][4], $aCtrlInfo[$i][5], $aCtrlInfo[$i][6], $aCtrlInfo[$i][7])
            EndSwitch
            GUICtrlSetOnEvent(-1, "_HandleCtrlEvent")
        Next
    EndFunc
    Alles anzeigen

    lg schönen Abend

  • Guielemente im Array

    • casi4712
    • 28. Mai 2024 um 17:22

    ;)

  • Guielemente im Array

    • casi4712
    • 28. Mai 2024 um 17:05

    ok dann waren es 2 sachen, aber wie gesagt hatte erst 8 und dann andere durchprobiert, was sicher schwachsinn war, dann weiss ich Bescheid. Aber trotzdem, dass hier GUICtrlSetTip(-1, $arElements[$i][8])) ging ja auch nicht. Vielleicht sollte ich mit sowas nächste mal nicht um halb 2 Uhr nachts anfangen lach


    danke noch mal

  • Guielemente im Array

    • casi4712
    • 28. Mai 2024 um 16:16

    Also ehrlich gesagt seh ich jetzt nicht ganz was du jetzt funktionstechnisch anders gemachet hast, ausser die VAriablennamen umbenannt und das GuiEvent, ansonsten hatte ich auch das mit 9 probiert, als Funktion hatte ich es auch, aber GUICtrlSetTip(-1, $arElements[$i][9]) hatte einfach nicht funktioniert, will ja nur verstehen warum;).

    Aber es funzt jetzt danke noch mal.


    lg

  • Guielemente im Array

    • casi4712
    • 28. Mai 2024 um 16:11

    hallo danke für deine Reaktion, also verzählt weiss ich nicht, da hatte ich auch dran gedacht, han von 6-10 alles probiert ging nie, aber ich schau mal was du da feines hast


    lg und schönen Abend noch

  • Guielemente im Array

    • casi4712
    • 28. Mai 2024 um 13:01

    Hallo liebe Hardcorecoder, mal ne praktische Frage. Ich lege mittlereile meine Buttons mit Hilfe von Arrays an. Nun hatte ich mir überlegt auch andere GUIelemente in einem Array zu verarbeiten. Das hat soweit auch funktioniert, nur komischerweise zeigt er die Tolltips von Icons nicht an, vielleicht sieht ja einer den Fehler, eh ich grauwe Haare kriege;)

    AutoIt
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <Array.au3>
    
    ;Global $button1, $Icon1
    
    Local $arElements = [ _
        ["Button1", "Button", "Save List", 10, 340, 100, 30, "Liste speichern", "", ""], _
        ["Button2", "Button", "Host1", 210, 30, 70, 30, "nd", "", ""], _
        ["Button3", "Button", "Host2", 210, 70, 70, 30, "nd", "", ""], _
        ["Button4", "Button", "Workgroup", 210, 110, 70, 30, "nd", "", ""], _
        ["Button5", "Button", "Fritz", 280, 30, 70, 30, "nd", "", ""], _
        ["Button6", "Button", "IT-Service", 280, 70, 70, 30, "nd", "", ""], _
        ["Button7", "Button", "Lesesaal", 280, 110, 70, 30, "nd", "", ""], _
        ["Button14", "Button", "Save and choose file", 190, 340, 160, 30, "sdsds", "", ""], _
        ["Checkbox1", "Checkbox", "AdminUser", 10, 390, 90, 20, "", $GUI_CHECKED, ">>>"], _
        ["Label1", "Label", "Freie Listen", 210, 10, 100, 20, "", "", "9,800,800"], _
        ["Icon1", "Icon", "shell32.dll", 168, 320, 390, 50, 50, "Öffnet die Settings", "", ""] _
    ]
    
    Local $hParent = GUICreate("TESTGUI", 500, 500)
    GUISetState(@SW_SHOW, $hParent)
    
    Local $Element[UBound($arElements)]
    For $i = 0 To UBound($arElements) - 1
        Switch $arElements[$i][1]
            Case "Button"
                $Element[$i] = GUICtrlCreateButton($arElements[$i][2], $arElements[$i][3], $arElements[$i][4], $arElements[$i][5], $arElements[$i][6])
                GUICtrlSetTip($Element[$i], $arElements[$i][7])
            Case "Checkbox"
                $Element[$i] = GUICtrlCreateCheckbox($arElements[$i][2], $arElements[$i][3], $arElements[$i][4], $arElements[$i][5])
                GUICtrlSetState($Element[$i], $arElements[$i][8])
            Case "Label"
                $Element[$i] = GUICtrlCreateLabel($arElements[$i][2], $arElements[$i][3], $arElements[$i][4], $arElements[$i][5])
                If $arElements[$i][9] <> "" Then
                    Local $fontParams = StringSplit($arElements[$i][9], ",")
                    GUICtrlSetFont($Element[$i], $fontParams[1], $fontParams[2], $fontParams[3])
                EndIf
            Case "Icon"
                $Element[$i] = GUICtrlCreateIcon($arElements[$i][2], $arElements[$i][3], $arElements[$i][4], $arElements[$i][5], $arElements[$i][6], $arElements[$i][7], $arElements[$i][8])
                GUICtrlSetTip($Element[$i], $arElements[$i][9])
        EndSwitch
        Assign($arElements[$i][0], $Element[$i]) ; Weise die ID direkt den globalen Variablen zu
    Next
    
    ; Hauptschleife
    While 1
        Switch GUIGetMsg() ; Ereignis abrufen
            Case $GUI_EVENT_CLOSE
                Exit ; Beenden, wenn das Fenster geschlossen wird
            Case $Button1
                MsgBox($MB_OK, "Button Clicked", "Save List") ; Meldung anzeigen, wenn Button1 geklickt wird
            Case $Button2
                MsgBox($MB_OK, "Button Clicked", "Host1") ; Meldung anzeigen, wenn Button2 geklickt wird
            Case $Button3
                MsgBox($MB_OK, "Button Clicked", "Host2") ; Meldung anzeigen, wenn Button3 geklickt wird
            Case $Button14
                MsgBox($MB_OK, "Button Clicked", "Save and choose file") ; Meldung anzeigen, wenn Button14 geklickt wird
            ; Fügen Sie hier weitere Cases für die anderen Buttons hinzu
        EndSwitch
    WEnd
    Alles anzeigen


    lg und schöne Woche noch

Spenden

Jeder Euro hilft uns, Euch zu helfen.

Download

AutoIt Tutorial
AutoIt Buch
Onlinehilfe
AutoIt Entwickler
  1. Datenschutzerklärung
  2. Impressum
  3. Shoutbox-Archiv
Community-Software: WoltLab Suite™