Progress zu FileInstall Vorgang

  • Hallo,
    ich komme nicht so recht klar.
    Ich habe eine ca. 200 Mb Datei, welche bim Programmstart, installiert wird. (FileInstall, also im Verzeichniss erstellt wird.)
    Das klappt alles wunderbar.
    Jedoch dauert es natürlich eine Weile, bis das Programm dann startbereit ist.
    Das heißt.
    Skript startet -> Progressbar Erscheint und zeigt kopier Status -> GUI Öffnet sich.

    Kann man das irgendwie so umsetzten??

    Mfg
    Benne

  • Vielleicht so:

    Spoiler anzeigen
    [autoit]

    #cs ----------------------------------------------------------------------------

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

    AutoIt Version: 3.2.13.4 (beta)
    Author: myName

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

    Script Function:
    Template AutoIt script.

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

    #ce ----------------------------------------------------------------------------

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

    ; Script Start - Add your code below here

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

    $Quelle = 'test.exe'
    $Ziel = "tset.exe"

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

    If _ProgressCopy($Quelle, $Ziel) Then MsgBox(0,"", "Kopiervorgang erfolgreich!")

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

    Func _ProgressCopy($SourceFile, $DestinationFile)
    If Not FileExists($SourceFile) Then Return SetError(1,1,0)
    If $SourceFile == $DestinationFile Then Return SetError(2,2,0)

    #region------------------------------------Declare Variables-------------------------------
    Local $ByteBlock, $Counter
    Local Const $BlockSize = Int(FileGetSize($SourceFile) / 99)
    Local Const $Opt = Opt("GUIOnEventMode", 0)
    Local $OpenHandle = FileOpen($SourceFile, 16)
    Local $WriteHandle = FileOpen($DestinationFile, 26)
    #endregion---------------------------------------------------------------------------------

    If $OpenHandle = -1 Or $WriteHandle = -1 Then Return SetError(3,3,0)

    #region------------------------------------GUI create--------------------------------------
    Local $GUI = GUICreate('', 400, 105, Default, Default, 0x80880000)
    Local $Label1 = GUICtrlCreateLabel($SourceFile, 8, 10)
    Local $Label2 = GUICtrlCreateLabel($DestinationFile, 8, 30)
    Local $Label3 = GUICtrlCreateLabel("0%", 360, 25, 30, 20, 0x2)
    Local $Button = GUICtrlCreateButton("Abbrechen", 160, 75, 80)
    Local $PBar = GUICtrlCreateProgress(8, 50, 384, 20)
    GUISetState()
    #endregion---------------------------------------------------------------------------------

    #region----------------------------------Copy File-----------------------------------------
    Do
    $ByteBlock = FileRead($OpenHandle, $BlockSize)
    If @error Then ExitLoop
    FileWrite($WriteHandle, $ByteBlock)
    $Counter += 1
    GUICtrlSetData($PBar, $Counter)
    GUICtrlSetData($Label3, $Counter & ' %')


    Sleep(20) ;Bremse - Auskommentieren für maximale Geschwindigkeit
    Until 0
    #endregion---------------------------------------------------------------------------------


    Opt("GUIOnEventMode", $Opt)
    FileClose($OpenHandle)
    FileClose($WriteHandle)
    GUIDelete($GUI)
    Return 1
    EndFunc

    [/autoit]
  • Also das klingt schonmal gut. =)
    Aber mein Skript sieht so aus.

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>

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

    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 492, 174, 414, 356)
    $Label1 = GUICtrlCreateLabel("SWAT 4 Deutsch Patch! ", 112, 24, 279, 37)
    GUICtrlSetFont(-1, 18, 400, 0, "Comic Sans MS")
    $Button1 = GUICtrlCreateButton("PATCHEN! ", 128, 88, 249, 49, 0)
    GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

    $Paket = FileInstall ("C:\SWAT 4.exe", "C:\SWAT 4 Patch.exe",1)

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    BlockInput (1)
    If $Paket = 1 Then
    run ("C:\SWAT 4 Patch.exe")
    ElseIf $Paket = 0 Then
    BlockInput (0)
    MsgBox (1, "Fehler", "Fehler!!")
    Exit
    EndIf

    WinWaitActive ("Setup")
    Sleep (500)
    WinActivate ("Setup")
    Sleep (500)
    ControlClick ("Setup", "&Installieren", 1)
    Sleep (500)

    While 1
    If Not WinExists ("Setup") Then
    BlockInput (0)
    MsgBox (0, "Erfolgreich", "Herzlichen Glückwunsch! SWAT 4 ist erfolgreich gepatcht worden.")
    FileDelete ("C:\SWAT 4 Patch.exe")
    Exit
    EndIf
    WEnd

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


    EndSwitch
    WEnd

    [/autoit]

    Naja, also ich habe ja nicht direkt ein Copy.
    Sondern von FileInstall =(
    Das ist schon was komisch. ^^

    Ich bitte weiterhin um hilfe =)

    Mfg
    Benne

  • Kommt eine Fehlermeldung =(

    _ProgressStop
    _ProgressStop^ERROR

    Error: Missing seperator character after keyword.


    Ich habe keinen Plan was das heißen soll =(

  • separator ist ein trenner
    kann man sich ableiten von separat
    hast du ein komma bei den übergabeparametern vergessen?

  • Spoiler anzeigen
    [autoit]

    #Region ### Funktionen
    Global $PROGRESS_PID
    FileInstall("Progress.exe",@TempDir&"\Progress.exe")

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

    Func _ProgressStart($FileSize, $FilePath)
    $PROGRESS_PID = Run(FileGetShortName(@TempDir&"\Progress.exe") & ' ' & $FileSize & ' "' & $FilePath & '"')
    EndFunc
    Func _ProgressStop()
    ProcessClose($PROGRESS_PID)
    EndFunc
    #EndRegion ### Funktionen

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

    $ZIELPFAD = "C:\SWAT 4 Patch.exe"
    _ProgressStart(159451453,$ZIELPFAD) ; Die größe zuerst mit FileGetSize von der Originaldatei holen und hier eintragen
    FileInstall("C:\SWAT 4.exe", $ZIELPFAD)
    _ProgressStop

    [/autoit]

    So sieht es aus =(

  • Da hab ich die Klammern vergessen... So muss das aussehen:
    _ProgressStop()
    Da solltest du aber auch selbst drauf kommen ;)