Das Notes Forum
Domino 9 und frühere Versionen => Entwicklung => Thema gestartet von: HaPe am 29.07.02 - 12:51:49
-
Hi Leute,
ich brauche für einen Anwendung die Möglichkeit auf RAR und ZIP Dateien zuzugreifen und die Liste der im Archive enthaltenen Dateien zu ermitteln. Warscheinlich auch einige Textdateien auszupacken.
Hat jemand schon mal versucht existierende VisualBasic Beispiele für Lotus Script umzusetzen oder Hat schon einen fertiges Script Libary?
-
Ich habe sowas schon gemacht, am einfachsten geht es, über die KomandozeilenVariante der Packer
ID =
Shell("winzip.exe -e -o -j C:\Filename.ZIP ZielDir",6)
Man muß den genauen Pfad zum WinZip-Programm angeben, die benötigten Parameter angeben, den Namen der Zip-Datei, und das ZielVerzeichnis.
Die genauen Parameter und Optionen findet man auf den WebSeiten der Packer
-
Hi,
den weg hab ich auch schon genommen.
Nur wenn du den Inhalt des Archives ermitteln willst musst du die Ausgabe erst in einen Textdatei umlenken und diese dann wieder einlesen und auswerten.
Ich weiß das es über die unzip.dll einen Weg giebt diese Angaben direkt in ein Array zurückzubekommen.
Nur wenn ich mir die VB Beispiele Ansehe wird das umsetzen nach Lotus Script etwas umstänlicher. Smit wollte ich mir doppelte Arbeit ersparen, fals das schon mal jemand umgestzt hat....
-
Poste doch mal bitte die Beispiele
-
Ich habe hier eine Klasse, die die Datei "unzip.exe" verwendet.
Die Datei ist Freeware
http://www.dpo.uab.edu/software/unzip/getunzipPC.html
Kann sein, dass das nicht der richtige Link ist; einfach mal bei Google suchen.
Zum Thema Unzip mit LS habe ich hier auch noch was
http://eknori.dyndns.org/knowledge/devidea.nsf/703257f00a483fb180256879002c0178/f28f099f53d9cf12802568e40037f9d0?OpenDocument&Highlight=0,unzip
eknori
Type STARTUPINFO
cb As Long
lpReserved As String
lpDesktop As String
lpTitle As String
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Long
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type
Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessID As Long
dwThreadID As Long
End Type
Declare Function WaitForSingleObject Lib "kernel32" (Byval hHandle As Long, Byval dwMilliseconds As Long) As Long
Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (Byval hwnd As Long, Byval lpOperation As String, Byval lpFile As String, Byval lpParameters As String, Byval lpDirectory As String, Byval nShowCmd As Long) As Long
Declare Function CreateProcessA Lib "kernel32" (Byval lpApplicationName As Long, Byval lpCommandLine As String, Byval lpProcessAttributes As Long, Byval lpThreadAttributes As Long, Byval bInheritHandles As Long, Byval dwCreationFlags As Long, _
Byval lpEnvironment As Long, Byval lpCurrentDirectory As Long, lpStartupInfo As STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION) As Long
Declare Function CloseHandle Lib "kernel32" (Byval hObject As Long) As Long
'// Options for unzip.exe
'// for more options see the documentation of "unzip.exe"
Const QUIETMODE = " -qq " ' do not show messages
Const OVERWRITE = " -o " ' overwrite existing files
Const NEVER_OVERWRITE = " -n " ' never overwrite existing files
Const REFRESH = " -f " ' freshen existing file, create none
Const UPDATE = " -u " ' update files, create if necessary
Const ZIPINFO = " -Z -t " ' Summary of Zip-File
Const ZIPINFO_VERBOSE = " -Z -2 -t " ' Like ZIPINFO including FileNames
Const ZIPINFO_FILE = "~ZIPINFO.TMP" ' File containing ZIP-Informations
Const ZIPINFO_WZUNZIP = " -v "
Class UnzipFile
Private ExeFile As String
Private ExtractTo As String
Private FilesToExtract As String
Private UnzipOptions As String
Declare Public Sub New(UnzipExe As String, ExtractFilesTo As String)
Declare Private Function IsPathAvailable(path As String) As Variant
Declare Private Function IsDriveAvailable(drivNam$) As Variant
Declare Public Function Unzip(Files As String, Options As String)
Declare Public Function ZipInfo(Files As String)
Declare Private Sub ShellAndWait(Byval RunProg As String)
Declare Public Property Get Executable As String
Declare Public Property Set Executable As String
Declare Public Property Get TargetPath As String
Declare Public Property Set TargetPath As String
Sub New (UnzipExe As String, ExtractFilesTo As String)
'// Constructor
ExeFile = UnzipExe
dummy = IsPathAvailable(ExtractFilesTo)
ExtractTo = ExtractFilesTo
End Sub
Public Property Get Executable As String
Executable = ExeFile
End Property
Public Property Set Executable As String
ExeFile = Executable
End Property
Public Property Get TargetPath As String
TargetPath = ExtractTo
End Property
Public Property Set TargetPath As String
dummy = IsPathAvailable(TargetPath)
ExtractTo = TargetPath
End Property
Public Function Unzip(Files As String, Options As String)
'// Unzip Files
FilesToExtract = Files
UnzipOptions = Options
CommandStr = ExeFile & UnzipOptions & FilesToExtract & " -d " & ExtractTo
Call ShellAndWait(CommandStr)
End Function
Public Function ZipInfo(Files As String)
'// Unzip Files
FilesToExtract = Files
CommandStr = ExeFile & ZIPINFO_WZUNZIP & FilesToExtract & " > ZIPINFO"
Call ShellAndWait(CommandStr)
Msgbox ZIPINFO
End Function
Private Function IsDriveAvailable(drivNam$) As Variant
'// Test for existing drive and Path
'// if Path does not exist, create it
On Error Goto Errors
IsDriveAvailable = False
If Dir$(drivNam, 8) <> "" Then
IsDriveAvailable = True
End If
TheEnd:
Exit Function
Errors:
Resume TheEnd
End Function
Private Function IsPathAvailable(path As String) As Variant
'// Test, ob das Pfad vorhanden ist; wenn nicht, wird Pfad angelegt
Dim session As New NotesSession
Dim MyPath$, tmpPath$
Dim result%, pos%
On Error Resume Next
If IsDriveAvailable(Left(path,3)) Then
Chdrive Left( path, 1 )
Chdir path
result = False
pos = 1
If Curdir + "\" <> path Then
If Right( path, 1 ) <> "\" Then path = path + "\"
If path = "" Then Goto Exit_CheckDir
Chdrive Left( path, 1 )
Do While pos <> 0
pos = Instr( pos, path, "\" )
If pos > 0 Then
tmpPath = Left( path, pos-1 )
Mkdir tmpPath
Chdir tmpPath
pos = pos + 1
End If
Loop
If Curdir + "\" = path Then
result = True
End If
Else
result = True
End If
Else
End If
Exit_checkDir:
IsPathAvailable = result
Exit Function
End Function
Private Sub ShellAndWait(Byval RunProg As String)
Dim proc As PROCESS_INFORMATION
Dim StartInf As STARTUPINFO
StartInf.cb = Len(StartInf)
RetVal = CreateProcessA(0&, RunProg, 0&, 0&, 1&, NORMAL_PRIORITY_CLASS, 0&, 0&, StartInf, proc)
RetVal = WaitForSingleObject(proc.hProcess, INFINITE)
RetVal = CloseHandle(proc.hProcess)
End Sub
End Class
-
Erstmal danke für die Infos. Die sind nicht schlecht.
Wies jemand ob das LSX noch weiterentwickelt wurde?
Die Beispiele die ich habe kann ich dir gerne schicken, wie war nochmal deine Mail? Sie hier zu posten wäre etwas zu umfangreich.