Input Felder, OK-Butten, Email, ...

  • Ich würde es so machen:

    Spoiler anzeigen
    [autoit]

    #include <ComboConstants.au3>
    #include <GuiConstantsEx.au3>
    #include <GUIConstants.au3>

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

    ; update-funktion

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

    Global $hFile = FileOpen(@DesktopDir & "\Test.txt", 1)
    Global $sUserName = "benutzer"
    Global $sDomain = "domäne"
    Global $sPassword = "passwort"
    Global $sStartDatei

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

    GUICreate("Test", 250, 200)

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

    GUICtrlCreateLabel("Benutzername:", 20, 10)
    Global $cInput_1 = GUICtrlCreateInput("", 20, 25, 200, 20)

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

    GUICtrlCreateLabel("Programm:", 20, 60)
    Global $cProgram = GUICtrlCreateCombo("", 20, 75, 200, 20, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL))
    GUICtrlSetData(-1, "Firefox|Chrome|IE")

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

    GUICtrlCreateLabel("Grund:", 20, 110)
    Global $cInput_3 = GUICtrlCreateInput("", 20, 125, 200, 20)

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

    Global $cSave = GUICtrlCreateButton("Speichern", 80, 160, 80, 25)

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

    GUISetState()

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

    While 1
    If GUICtrlRead($cInput_1) <> "" And GUICtrlRead($cProgram) <> "" And GUICtrlRead($cInput_3) <> "" Then
    If BitAND(GUICtrlGetState($cSave), $GUI_DISABLE) Then GUICtrlSetState($cSave, $GUI_ENABLE)
    Else
    If BitAND(GUICtrlGetState($cSave), $GUI_ENABLE) Then GUICtrlSetState($cSave, $GUI_DISABLE)
    EndIf

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

    Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE
    FileClose($hFile)
    Exit
    Case $cSave
    $sTime = @YEAR & "-" & @MON & "-" & @MDAY & "/" & @HOUR & ":" & @MIN & ":" & @SEC
    FileWriteLine($hFile, $sTime & ":" & @TAB & GUICtrlRead($cInput_1) & @TAB & GUICtrlRead($cProgram) & @TAB & GUICtrlRead($cInput_3))
    RunAs($sUserName, $sDomain, $sPassword, 0, $sStartDatei)
    ;RunAs($sUserName, $sDomain, $sPassword, 0, @AutoItExe & ' /AutoIt3ExecuteLine "ShellExecute(''' & $commands[$i] & ''')"', @SystemDir)
    ;RunAsWait($sUserName, $sDomain, $sPassword, 0, $sStartDatei)
    Case $cProgram
    Switch GUICtrlRead($cProgram)
    Case "Firefox"
    $sStartDatei = "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
    Case "Chrome"
    $sStartDatei = "C:\Users\Thomann\AppData\Local\Google\Chrome\Application\chrome.exe"
    Case "IE"
    $sStartDatei = "C:\Program Files\Internet Explorer\iexplore.exe"
    EndSwitch
    EndSwitch
    WEnd

    [/autoit]
  • ich Dank die vielmals für die Hilfe =)

    und die Update Funktion passt die soweit?
    am liebsten wär mir ja nur eine .exe, die die Update-Funktion einschließt

    version.txt

    Code
    [versionsection]
    versionskey=versionsname 1.2


    Update.exe

    [autoit]


    Tooltip("Update",0,0)
    FileCopy("D:\test1\runas.exe", "D:\test2\runas.exe", 1)
    MsgBox(0,"","Update abgeschlossen - starte programm")
    Exit Run("D:\test2\runas.exe")

    [/autoit]


    Funktion im Scirpt

    [autoit]


    $version = "versionsname 1.0"

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

    If FileExists(@ScriptDir & "\Update.exe") Then
    FileCopy("D:\test1\version.txt", "D:\test2\version.txt", 1)
    $aktuelle_version = IniRead("D:\test2\version.txt","versionsection","versionskey","")
    FileDelete("D:\test2\version.txt")
    IF $aktuelle_version <> $version Then
    MsgBox(0,"","Update nötig")
    Exit Run("D:\test2\Update.exe")
    Else
    MsgBox(0,"","Kein neues Update")
    Endif
    Else
    MsgBox(0,"Warnung","Update.exe nicht gefunde")
    EndIf

    [/autoit]