Das Notes Forum

Domino 9 und frühere Versionen => ND8: Entwicklung => Thema gestartet von: frogger am 01.02.11 - 15:09:52

Titel: prob mit CreateObject("Shell.Application")
Beitrag von: frogger am 01.02.11 - 15:09:52
hi,
ich habe für notes einen agenten geschrieben, der im endeffekt eine datei entpacken soll:
Code
Sub Initialize
	Dim oUnzipFSO As Variant
	Dim obj As Variant
	Set oUnzipFSO = CreateObject("Scripting.FileSystemObject")
	If Not oUnzipFSO.FolderExists("C:\unzip") Then
		oUnzipFSO.CreateFolder("C:\unzip")
	End If
	Set obj = CreateObject("Shell.Application")
	Call obj.NameSpace("C:\").CopyHere(obj.NameSpace("C:\unzip\pl.zip").Items)
	Set oUnzipFSO = Nothing
	MsgBox("ok")
End Sub
die zeile
'Call obj.NameSpace("C:\").CopyHere(obj.NameSpace("C:\unzip\pl.zip").Items)'
wirft den runtimeerror:
'Automation object not found.'
ich hab keine ahnung was ich dagegen machen soll oder was ich falsch mache. bitte helft mir.
Titel: Re: prob mit CreateObject("Shell.Application")
Beitrag von: m3 am 01.02.11 - 15:12:48
Fehlerbehandlung?
Check mal, ob der CreateObject call überhaupt gut geht.
Titel: Re: prob mit CreateObject("Shell.Application")
Beitrag von: frogger am 01.02.11 - 15:54:46
ich hab die sache zum laufen bekommen.
zur info:
Code
Option Public
Option Declare

Sub Initialize
	Dim oUnzipFSO As Variant
	Dim obj As Variant
	Dim source As String
	Dim destination As String
	source="C:\pl.zip"
	destination="C:\unzip"
	Set oUnzipFSO = CreateObject("Scripting.FileSystemObject")
	If Not oUnzipFSO.FolderExists(destination) Then
		oUnzipFSO.CreateFolder(destination)
	End If
	Set obj = CreateObject("Shell.Application")
	Call obj.NameSpace("" & destination).CopyHere(obj.NameSpace("" & source).Items())
	Set oUnzipFSO = Nothing
	MsgBox("ok")
End Sub
es ist wirklich nicht zu glauben weswegen man manchmal stundenlang sucht. es war einfach nur die '()' am ende von Items
außerdem ist zubeachten, dass NameSpace die variablen nicht einfach so schluckt. scheinbar ergibt das hinzufügen von >>>"" & <<< eine art expliziten typecast auf string, ohne den es einfach nicht funktioniert.
ich habe das ganze vorher per VBS versuch und dort sind solche sachen nicht nötig.
in meinen augen alles ziemlich seltsam...naja....