WinRar ähnliches Programm in AutoIt erstellen.

  • @ oscar:

    kla darf man ein trennzeichen benutzen oda nich?!
    in dateinamen darf "|" nicht vorkommen, zumindest bei windows^^, un FileRead gibt ja nur 0-9 und A-F zurück oder?

    • Offizieller Beitrag


    kla darf man ein trennzeichen benutzen oda nich?!


    Es ist nicht zu empfehlen. Da es als Zeichen im Inhalt vorkommen kann, sollte man von Anfang an diese Fehlerquelle ausschließen. Header mit den Positionsdaten ist eine saubere Sache.

  • Habs hinbekommen mehrere Dateien zusammenzuklatschen :)
    Kann sie auch wunderbar wieder trennen, mit originalname usw...
    Aber: die Größe im gepackten Zustand ist das doppelte -.-
    Beispiel: Mp3-Datei (10MB), ich packe sie, Test.tdz (mein Dateityp, 20MB) -.- ich hab so en Album gepackt und aus 100MB 200 gemacht -.- ist ziemlich dämlich, weiß jmd Rat? :whistling:

    [autoit]


    While $Life = True
    $nMSG = BrainGetMsg()
    Switch $nMSG
    Case $Idea
    _Convert_Idea2Code()
    EndSwitch
    WEnd

    [/autoit]
  • natürlich :D
    gar nicht dran gedacht... :whistling:

    Spoiler anzeigen
    [autoit]


    $path = @scriptdir & "/paths.txt" ; pro zeile 1 pfad einer Datei
    $count = _FileCountLines($path)
    for $i = 1 to $count
    $file = FileOpen($path, 0)
    $text = FileReadLine($file, $i)
    $dt = FileOpen($text, 16)
    $x = FileRead($dt)
    $type = StringSplit($text, "\")
    $type = $type[$type[0]]
    $data = $data & $x
    fileclose($file)
    fileclose($dt)
    next

    [/autoit]
    Spoiler anzeigen
    [autoit]

    $savefile = FileSaveDialog("Speicherort wählen", "", "TDZ-Verpackung(*.tdz)") ; diese Zeilen speichern das ausgelesene Material
    $endfile = FileOpen($savefile & ".tdz", 10)
    FileWrite($endfile, $data)
    FileClose($endfile)

    [/autoit]
    [autoit]


    While $Life = True
    $nMSG = BrainGetMsg()
    Switch $nMSG
    Case $Idea
    _Convert_Idea2Code()
    EndSwitch
    WEnd

    [/autoit]
  • okee ist aber noch nicht ganz fertig...kann mir vllt auch jmd tipps zur statusbar geben?

    Spoiler anzeigen
    [autoit]

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

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

    AutoIt Version: 3.3.0.0
    Author: GE IXI TIM

    [/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
    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <ListViewConstants.au3>
    #include <WindowsConstants.au3>
    #include <GuiListView.au3>
    #include <File.au3>
    #include <Array.au3>
    #include <String.au3>
    #include <GuiStatusbar.au3>
    #include <Date.au3>
    #include <String.au3>
    $datacontent = ""
    $path = @ScriptDir & "/paths.ini"
    FileWrite($path, "")
    #Region ### START Koda GUI section ### Form=
    $Form2 = GUICreate("Verpackungsprogramm by GE IXI TIM", 773, 510, 216, 106, -1, BitOR($WS_EX_ACCEPTFILES,$WS_EX_WINDOWEDGE))
    $StatusBar1 = _GUICtrlStatusBar_Create($Form2, -1)
    Dim $StatusBar1_PartsWidth[2] = [150, 250]
    _GUICtrlStatusBar_SetParts($StatusBar1, $StatusBar1_PartsWidth)
    _GUICtrlStatusBar_SetText($StatusBar1, " datum ", 0)
    _GUICtrlStatusBar_SetText($StatusBar1, "pfad ", 1)
    $ListView1 = GUICtrlCreateListView("Name|Größe|Pfad", 0, 0, 770, 470)
    GUICtrlSetState(-1, $GUI_DROPACCEPTED)
    GUICtrlSendMsg(-1, 0x101E, 0, 150)
    GUICtrlSendMsg(-1, 0x101E, 1, 50)
    GUICtrlSendMsg(-1, 0x101E, 2, 300)
    $datei = GUICtrlCreateMenu("Datei")
    $ListView1context = GUICtrlCreateContextMenu($ListView1)
    $pack = GUICtrlCreateMenuItem("Alles Packen", $ListView1context)
    $depack = GUICtrlCreateMenuItem(" Bei Archiv entpacken", $ListView1context)
    $condepackall = GUICtrlCreateMenuItem("Dateien entpacken...", $ListView1context)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    FileDelete($path)
    Exit
    Case $Gui_EVENT_DROPPEd
    $txt = StringSplit(@GUI_DragFile, "\")
    $size = FileGetSize(@GUI_DragFile)
    GUICtrlCreateListViewItem($txt[$txt[0]] & "|" & Round($size / 1024 / 1024, 2) & "|" & @GUI_DragFile, $ListView1)
    FileWriteLine($path, @GUI_DragFile)
    Case $pack
    _verpacken()
    Case $condepackall
    $fils = FileOpenDialog("Archiv wählen", "", "TDZ-Verpackung(*.tdz)")
    $diro = FileSaveDialog("Ordner wählen", "", "(ORDNER)")
    _entpacken($fils,$diro, "")
    Case $depack
    $file = FileOpenDialog("Archiv wählen", "", "TDZ-Verpackung(*.tdz)")
    _entpacken($fils)
    EndSwitch
    WEnd

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

    Func _verpacken()
    $count = _FileCountLines($path)
    for $i = 1 to $count
    $file = FileOpen($path, 0)
    $text = FileReadLine($file, $i)
    $dt = FileOpen($text, 16)
    $x = FileRead($dt)
    $type = StringSplit($text, "\")
    $type = $type[$type[0]]
    MsgBox(0, "", $type)
    $datacontent = $datacontent & "-" & $type & "-" & $x& "®"
    FileClose($dt)
    FileClose($file)
    Next

    EndFunc

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

    Func _entpacken($file, $path = @ScriptDir, $dirname = "/Archiv")
    If StringLeft($dirname, 1) not = "/" Or "\" Then $dirname = "\" & $dirname
    $dick = FileOpen($file, 0)
    $text = FileRead($dick)
    $xmsg = StringSplit($text, "®")
    _ArrayDisplay($xmsg)
    for $i = 1 to $xmsg[0] -1
    $type = _StringBetween($xmsg[$i], "-","-")
    $type = $type[0]
    GUICtrlCreateListViewItem($type & "|unknown|", $ListView1)
    $main =stringReplace($xmsg[$i], "-","")
    $main = StringReplace($main, "-","")
    $main = StringReplace($main, $type, "")
    DirCreate( $path & $dirname )
    $xpath = $path & $dirname & "\" & $type
    $dicker = FileOpen($xpath, 18)
    FileWrite($dicker, $main)
    FileClose($dicker)
    Next
    EndFunc

    [/autoit]


    edit: zeilt mit hextostring war noch drin^^ war nur um was zu testen...sry :whistling:

    [autoit]


    While $Life = True
    $nMSG = BrainGetMsg()
    Switch $nMSG
    Case $Idea
    _Convert_Idea2Code()
    EndSwitch
    WEnd

    [/autoit]

    Einmal editiert, zuletzt von GE IXI TIM (30. September 2009 um 20:27)

  • mhm...erst wollte jeder den Code und jtz sagt niemand was...
    Bestimmt so ein einfacher Fehler der mir nicht auffällt -.- ABER ICH KOMM NET DRAUF!!!
    Kann sich das bitte jemand ansehen? ;(

    [autoit]


    While $Life = True
    $nMSG = BrainGetMsg()
    Switch $nMSG
    Case $Idea
    _Convert_Idea2Code()
    EndSwitch
    WEnd

    [/autoit]
  • Hallo GE IXI TIM,

    kann das Skript leider nicht starten, folgende Fehlermeldung:

    Code
    "C:\Programme\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Programme\AutoIt3\Downloads\DTxPacker.au3" /autoit3dir "C:\Programme\AutoIt3" /UserParams    
    +>22:04:56 Starting AutoIt3Wrapper v.2.0.0.1    Environment(Language:0407  Keyboard:00000407  OS:WIN_XP/Service Pack 3  CPU:X86 OS:X86)
    >Running AU3Check (1.54.14.0)  from:C:\Programme\AutoIt3
    C:\Programme\AutoIt3\Downloads\DTxPacker.au3(87,32) : ERROR: syntax error
        If StringLeft($dirname, 1) not
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    C:\Programme\AutoIt3\Downloads\DTxPacker.au3 - 1 error(s), 0 warning(s)


    mfg (Auto)Bert

  • Spoiler anzeigen
    [autoit]

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

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

    AutoIt Version: 3.3.0.0
    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
    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <ListViewConstants.au3>
    #include <WindowsConstants.au3>
    #include <GuiListView.au3>
    #include <File.au3>
    #include <Array.au3>
    #include <String.au3>
    #include <GuiStatusbar.au3>
    #include <Date.au3>
    #include <String.au3>
    $datacontent = ""
    $path = @ScriptDir & "/paths.ini"
    FileWrite($path, "")
    #Region ### START Koda GUI section ### Form=
    $Form2 = GUICreate("Verpackungsprogramm by GE IXI TIM", 773, 510, 216, 106, -1, BitOR($WS_EX_ACCEPTFILES,$WS_EX_WINDOWEDGE))
    $StatusBar1 = _GUICtrlStatusBar_Create($Form2, -1)
    Dim $StatusBar1_PartsWidth[2] = [150, 250]
    _GUICtrlStatusBar_SetParts($StatusBar1, $StatusBar1_PartsWidth)
    _GUICtrlStatusBar_SetText($StatusBar1, " datum ", 0)
    _GUICtrlStatusBar_SetText($StatusBar1, "pfad ", 1)
    $ListView1 = GUICtrlCreateListView("Name|Größe|Pfad", 0, 0, 770, 470)
    GUICtrlSetState(-1, $GUI_DROPACCEPTED)
    GUICtrlSendMsg(-1, 0x101E, 0, 150)
    GUICtrlSendMsg(-1, 0x101E, 1, 50)
    GUICtrlSendMsg(-1, 0x101E, 2, 300)
    $datei = GUICtrlCreateMenu("Datei")
    $ListView1context = GUICtrlCreateContextMenu($ListView1)
    $pack = GUICtrlCreateMenuItem("Alles Packen", $ListView1context)
    $depack = GUICtrlCreateMenuItem(" Bei Archiv entpacken", $ListView1context)
    $condepackall = GUICtrlCreateMenuItem("Dateien entpacken...", $ListView1context)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    FileDelete($path)
    Exit
    Case $Gui_EVENT_DROPPEd
    $txt = StringSplit(@GUI_DragFile, "\")
    $size = FileGetSize(@GUI_DragFile)
    GUICtrlCreateListViewItem($txt[$txt[0]] & "|" & Round($size / 1024 / 1024, 2) & "|" & @GUI_DragFile, $ListView1)
    FileWriteLine($path, @GUI_DragFile)
    Case $pack
    _verpacken()
    Case $condepackall
    $fils = FileOpenDialog("Archiv wählen", "", "TDZ-Verpackung(*.tdz)")
    $diro = FileSaveDialog("Ordner wählen", "", "(ORDNER)")
    _entpacken($fils,$diro, "")
    Case $depack
    $fils = FileOpenDialog("Archiv wählen", "", "TDZ-Verpackung(*.tdz)")
    _entpacken($fils)
    EndSwitch
    WEnd

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

    Func _verpacken()
    $count = _FileCountLines($path)
    for $i = 1 to $count
    $file = FileOpen($path, 0)
    $text = FileReadLine($file, $i)
    $dt = FileOpen($text, 16)
    $x = FileRead($dt)
    $type = StringSplit($text, "\")
    $type = $type[$type[0]]
    MsgBox(0, "", $type)
    $datacontent = $datacontent & "-" & $type & "-" & $x& "®"
    FileClose($dt)
    FileClose($file)
    Next
    $savefile = FileSaveDialog("Speicherort wählen", "", "TDZ-Verpackung(*.tdz)")
    $endfile = FileOpen($savefile & ".tdz", 10)
    FileWrite($endfile, $datacontent)
    FileClose($endfile)
    EndFunc

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

    Func _entpacken($file, $path = @ScriptDir, $dirname = "Archiv")
    $dirname = "/" & $dirname
    $dick = FileOpen($file, 0)
    $text = FileRead($dick)
    $xmsg = StringSplit($text, "®")
    _ArrayDisplay($xmsg)
    for $i = 1 to $xmsg[0] -1
    $type = _StringBetween($xmsg[$i], "-","-")
    $type = $type[0]
    GUICtrlCreateListViewItem($type & "|unknown|", $ListView1)
    $main =stringReplace($xmsg[$i], "-","")
    $main = StringReplace($main, "-","")
    $main = StringReplace($main, $type, "")
    DirCreate( $path & $dirname )
    $xpath = $path & $dirname & "\" & $type
    $dicker = FileOpen($xpath, 18)
    FileWrite($dicker, $main)
    FileClose($dicker)
    Next
    EndFunc

    [/autoit]
    [autoit]


    While $Life = True
    $nMSG = BrainGetMsg()
    Switch $nMSG
    Case $Idea
    _Convert_Idea2Code()
    EndSwitch
    WEnd

    [/autoit]
  • hatte nen fehler den ich nicht bemerkte, weil ich die Funktion _entpacken() nicht aufrufte :D

    [autoit]


    While $Life = True
    $nMSG = BrainGetMsg()
    Switch $nMSG
    Case $Idea
    _Convert_Idea2Code()
    EndSwitch
    WEnd

    [/autoit]
  • ich will ja nur wissen warum die Datei doppelt so grpß ist -.-

    Zitat

    Falsch ist auf jeden Fall schonmal, dass Du mit "Zeilen" arbeitest. Eine Binärdatei hat keine Zeilen!

    das was du mit zeilen meinst...Ich lese nur die einzelnen Pfade aus, die ich aus dem ListView speichere.

    [autoit]


    While $Life = True
    $nMSG = BrainGetMsg()
    Switch $nMSG
    Case $Idea
    _Convert_Idea2Code()
    EndSwitch
    WEnd

    [/autoit]