default scriptdir ist auf einmal gewechselt...

  • ich verstehe nicht warum nach FileOpenDialog auf einmal mein default scriptdir das verzeichnis ist, ausdem ich mit FileOpenDialog eine datei selectiert habe .... auf jeden fall frage ich mich wie ich wieder zurückwechsel?. das komische ist auch, dass bei abfrage des delfault scriptdir (MsgBox(0,"",@ScriptDir)) der richtige pfad rauskommt !?
    thanx 4 help :D

    das hier ist das script bzw die funktion die es verursacht ...

    [autoit]


    #include <AVIConstants.au3>
    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <Array.au3>
    #include <File.au3>
    #include <GUIConstants.au3>
    #include <GuiListView.au3>
    #include <GuiImageList.au3>
    #include <Constants.au3>
    #include <inet.au3>
    #include <GuiEdit.au3>
    #include <GuiStatusBar.au3>
    #include <ScrollBarConstants.au3>
    #include <sendmessage.au3>
    #include <string.au3>
    #include <Zip32.au3>

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

    FileInstall("zip32.dll", @ScriptDir & "\zip32.dll")
    FileInstall("unzip32.dll", @ScriptDir & "\unzip32.dll")

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

    Global $destdirectory, $sourcefile, $sourcedirtozip, $destzipname, $timestring
    ;Global $sDate = 0, $sEncrypt = 0, $sSys = 1, $sEmptyFolder = 0, $sExcludeDate = 0, $sIncludeDate = 0, $sJunkDir = 0, $sMove = 0, $sUpdate = 0, $sFresh = 0, $sLatestTime = 0, $sComment = 0, $sPrivilege = 1, $sRecurse = 1, $sLevel = 9

    _StatsSaver()

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

    Func _StatsSaver() ; StatsSaver GUI
    $h10Gui = GUICreate("Stats Saver V1.0", 200, 200, -1, -1, $WS_MINIMIZEBOX)
    $Label61 = GUICtrlCreateLabel("Thanx for idea to ", 40, 70)
    ;GUICtrlCreatePic(@TempDir & "\logo.jpg", 10, 10, 425, 55)
    $QuitStats = GUICtrlCreateButton("X", 179, 0, 15, 15, 0)
    $RestoringStats = GUICtrlCreateButton("Restore Stats", 10, 120, 100, 15, 0)
    $SaveStats = GUICtrlCreateButton("Save Stats", 10, 140, 100, 15, 0)
    ;$input99 = GUICtrlCreateEdit("", 10, 90, 425, 380)
    GUISetState(@SW_SHOW)

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

    While 1
    $nMsg = GUIGetMsg()
    Sleep(20)
    Switch $nMsg
    Case $QuitStats
    GUIDelete($h10Gui)
    ExitLoop
    Case $RestoringStats
    $sourcefile = FileOpenDialog("Select a statsfile (zip archive)", @ScriptDir & "\statsbackup\" , "Stats files (*.zip)")
    _unpack($sourcefile, @ScriptDir & "\players")
    Case $SaveStats
    ;$sourcefile = FileOpenDialog("Select a zip archive", "", "Archive files (*.zip)")
    ;$destdirectory = FileSelectFolder("Output Folder", "", 1)
    ;_unpack($sourcefile, $destdirectory)
    ;$sourcefile = FileOpenDialog("Select a zip archive", "", "Archive files (*.zip)")
    ;$sourcedirtozip = FileSelectFolder("Output Folder", "", 1)
    ;$sourcedirtozip = (@ScriptDir & "\players")
    _checkifstatsbackupexists()
    _createtimestring()
    _pack(@ScriptDir & "\players", @ScriptDir & "\statsbackup\playerstats"&$timestring&".zip")
    EndSwitch
    WEnd
    EndFunc ;==>_tatsSaver

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

    Func _unpack($sourcefile, $destdirectory)
    _UnZip_Init("_UnZIP_PrintFunc", "UnZIP_ReplaceFunc", "_UnZIP_PasswordFunc", "_UnZIP_SendAppMsgFunc", "_UnZIP_ServiceFunc")
    _UnZIP_SetOptions()
    _UnZIP_Unzip($sourcefile, $destdirectory)
    If @error Then
    MsgBox(16, "Error", "Restorings stats and Archive unpacking error")
    Else
    MsgBox(64, "Success", "Restoring stats and archive unpacking successful")
    EndIf
    EndFunc

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

    Func _pack($sourcedirtozip, $destzipname)
    _Zip_Init("_ZIPPrint", "_ZIPPassword", "_ZIPComment", "_ZIPProgress")
    If @error Then
    MsgBox(16, "Error", "Zip32.dll did not initialize")
    Exit
    EndIf
    ; Global $sDate = 0, $sEncrypt = 0, $sSys = 1, $sEmptyFolder = 0, $sExcludeDate = 0, $sIncludeDate = 0, $sJunkDir = 0, $sMove = 0, $sUpdate = 0,
    ; $sFresh = 0, $sLatestTime = 0, $sComment = 0, $sPrivilege = 1, $sRecurse = 1, $sLevel = 9

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

    _ZIP_SetOptions(0,0,1,0,0,0,1)
    If @error Then
    MsgBox(16, "Error", "Options sets error")
    Exit
    EndIf

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

    _ZIP_Archive($destzipname, $sourcedirtozip)
    If @error Then
    MsgBox(16, "Error", "Saving stats and archive creating error")
    Else
    MsgBox(64, "Success", "Saving stats and archive creating successful")
    EndIf
    EndFunc

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

    Func _checkifstatsbackupexists()
    if DirGetSize(@ScriptDir & "\statsbackup") = -1 then DirCreate(@ScriptDir & "\statsbackup")
    EndFunc

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

    Func _createtimestring()
    Global $timestring = ("__date_"&@MON&"_"&@MDAY&"_"&@YEAR&"__time_"&@HOUR&"_"&@MIN&"_"&@SEC)
    EndFunc

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

    ;==========================# ZIP Dll-callback functions #======================================
    Func _ZIPPrint($sFile, $sPos)
    ConsoleWrite("!> _ZIPPrint: " & $sFile & @LF)
    EndFunc

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

    Func _ZIPPassword($sPWD, $sX, $sS2, $sName)
    Local $iPass = InputBox("Archive encrypting set", "Enter the password", "", "", 300, 120)

    If $iPass = "" Then Return 1

    Local $PassBuff = DllStructCreate("char[256]", $sPWD)
    DllStructSetData($PassBuff, 1, $iPass)
    EndFunc

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

    Func _ZIPComment($sComment)
    Local $iComment = InputBox("Archive comment set", "Enter the comment", "", "", 300, 120)
    If $iComment = "" Then Return 1

    Local $CommentBuff = DllStructCreate("char[256]", $sComment)
    DllStructSetData($CommentBuff, 1, $iComment)
    EndFunc

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

    ;~ Func _ZIPProgress($sName, $sSize)
    ;~ ;Return 1 for abort the zip!
    ;~ $CurZipSize += Number($sSize)
    ;~ Local $iPercent = Round(($CurZipSize / $UnCompSize * 100))
    ;~ GUICtrlSetData($progress, $iPercent)
    ;~ GUICtrlSetData($edit, $sName & @CRLF, 1)
    ;~
    ;~ ConsoleWrite("!> Name: " & $sName & @LF)
    ;~ EndFunc

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

    ;==========================# UnZIP Dll-callback functions #========================================
    Func _UnZIP_PrintFunc($sName, $sPos)
    ConsoleWrite("---> _UnZIP_PrintFunc: " & $sName & @LF)
    EndFunc

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

    Func UnZIP_ReplaceFunc($sReplace)
    If MsgBox(4 + 32, "Overwrite", "File " & $sReplace & " is exists." & @LF & "Do you want to overwrite all file?") = 6 Then
    Return $IDM_REPLACE_ALL
    Else
    Return $IDM_REPLACE_NONE
    EndIf
    EndFunc

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

    Func _UnZIP_PasswordFunc($sPWD, $sX, $sS2, $sName)
    ConsoleWrite("!> UnZIP_PasswordFunc: " & $sPWD & @LF)

    Local $iPass = InputBox("Password require", "Enter the password for decrypt", "", "", 300, 120)
    If $iPass = "" Then Return 1

    Local $PassBuff = DllStructCreate("char[256]", $sPWD)
    DllStructSetData($PassBuff, 1, $iPass)
    EndFunc

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

    Func _UnZIP_SendAppMsgFunc($sUcsize, $sCsize, $sCfactor, $sMo, $Dy, $sYr, $sHh, $sMm, $sC, $sFname, $sMeth, $sCRC, $fCrypt)
    ;ConsoleWrite("!> _UnZIP_SendAppMsgFunc: " & $sUcsize & @LF)
    EndFunc

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

    ;~ Func _UnZIP_ServiceFunc($sName, $sSize)
    ;~ ;Return 1 for abort the unzip!
    ;~ GUICtrlSetData($edit, $sName & @CRLF, 1)
    ;~
    ;~ ConsoleWrite("!> Size: " & $sSize & @LF & _
    ;~ "!> FileName" & $sName & @LF)
    ;~ EndFunc

    [/autoit]