Das Notes Forum

Domino 9 und frühere Versionen => ND6: Administration & Userprobleme => Thema gestartet von: BKreplin am 28.07.05 - 10:30:01

Titel: automation object member not found
Beitrag von: BKreplin am 28.07.05 - 10:30:01
Hallo,
wir scannen Dokumente über den Cobra-image-router in unsere Notes-DB ein.
Im Dokument gibt es einen Button, der den OCR-Text in ein Feld holt.

Seit wir Acrobat 5 durch Acrobat 7 ersetzt haben, kommt die Fehlermeldung "Automation object member not found".

Das entscheidende Codestück ist:

Set doc = Me.UiDoc.Document
Set rtItem = doc.GetFirstItem ( Me.InternalRTItemName )
If rtItem.Type = RICHTEXT Then
Forall RTObjects In rtItem.EmbeddedObjects
If ( RTObjects.Type = EMBED_ATTACHMENT ) Then
Call RTObjects.ExtractFile( Me.LocalFileName )
Exit Forall
End If

Im obigen Code ruft die Methode "ExtractFile" den Notes-Error 210 "Automation object member not found" hervor.

Kann mir jemand einen Tipp geben?

Vielen Dank
Brigitte Kreplin

   
Titel: Re: automation object member not found
Beitrag von: Axel am 28.07.05 - 10:45:21
Hi,

wo kommt den Me.LocalFileName her? Der gesamte Code wäre hier vielleicht hilfreich.

Unter Umständen hat sich an der COM-Schnittstelle beim Acrobat was geändert. Schau mal bei denen auf der Webseite nach. Meines Wissens gibt's dort irgendwo Infos dazu.

 
Axel
Titel: Re: automation object member not found
Beitrag von: BKreplin am 28.07.05 - 14:30:15
Danke Axel,

der gesamte Code ist ziemlich umfangreich.
Me.LocalFileName enthält den Pfad, in dem die extrahierte Datei temporär gespeichert sein soll. Der Wert sieht richtig aus. Ich kann die PDF-Datei dort auch sehen, diese jedoch nicht öffnen. Fehlermeldung: PDF Datei defekt

COM-Schnittstelle, was ist das? Ich habe auf die schnelle keine Infos dazu gefunden.
Titel: Re: automation object member not found
Beitrag von: klaussal am 28.07.05 - 14:36:47
Erklärung zur COM-Schnittstelle gibt's in der Designer-Hilfe unter dem Suchbegriff " COM & Schnittstelle".
Titel: Re: automation object member not found
Beitrag von: flaite am 28.07.05 - 15:11:31
Moment. Weisst Automation Error nicht eher darauf hin, dass hier eigentlich OLE und nicht COM benutzt wird?
Com ist soweit ich weiss nur insoweit in Domino implementiert, dass andere Programme auf Domino zugreifen können. Domino als ein Com-Server ist.
Wenn Notes auf ein anderes Programm zugreifen will, muss man - benutzt Domino - wenn ich mich nicht irre nach wie vor OLE.
Ich meine mich daran zu erinnern, dass bestimmte Notes Punkt Releases mit bestimmten Acrobat Versionen Probleme hatten. Vielleicht ist die Registry auch nicht 100% richtig eingestellt. Irgend sowas.
Titel: Re: automation object member not found
Beitrag von: Semeaphoros am 28.07.05 - 15:51:19
Axel, COM ist der Nachfolger von OLé und Notes kann beides, COM beretistellen (nur Backend) und COM von anderen Programmen nutzen.
Titel: Re: automation object member not found
Beitrag von: flaite am 28.07.05 - 16:14:26
Ich weiss. Es gibt aber unterschiedliche Klassen, die das unterstützen.
Und ich hab ein Gefühl (keine Gewissheit), dass hier OLE und nicht Com benutzt wird und die geschilderten Probleme irgendetwas damit zu tun haben.

Am Skriptcode ist der Unterschied daran zu erkennen wie NotesSession als Top-Element des Domino-Objekt Baums besorgt wird. Falls in dem OLE (oder COM) - Client Code gar nicht auf Domino, sondern auf das Acrobat OLE Objekt zugegriffen wird, dann dürfte das (bin mir nicht sicher) OLE sein, da Domino möglicherweise nur als Com-Server agieren kann, nicht als Com-Client.

Ich hatte da mal Verwirrung bei wird  Com oder Ole benutzt:
Set session = CreateObject(“Notes.NotesSession”) -> OLE
set session = CreateObject(“Lotus.NotesSession”) -> COM (Lotus. statt Notes.)

Die Initiialisierung dieser OLE/Com Objekte funktioniert über Late Binding. Automation Object Member not found weisst darauf hin, dass zur Laufzeit das eingebundene Objekt irgendwie unerwartet ist (deshalb der Hinweis auf evtl. nicht korrekte Registry Einträge in Folge von einer unsauberen Installation). 
Titel: Re: automation object member not found
Beitrag von: BKreplin am 28.07.05 - 17:18:50
Danke für die rege Diskussion.

Zur Frage COM oder OLE kann ich sagen, dass die bewusste Session mit

Set Me.session = New NotesSession
Set Me.workspace = New NotesUIWorkspace
Set Me.uidoc = workspace.CurrentDocument

eingerichtet wird.

Das spricht für OLE.

Mit der Registry kenne ich mich ebensowenig aus. Werde nächste Woche den Kollegen fragen, der Acrobat installiert hat. Oder habt Ihr noch nähere Hinweise??
Titel: Re: automation object member not found
Beitrag von: Glombi am 28.07.05 - 17:22:44
Also ein

RTObjects.Type = EMBED_ATTACHMENT
Call RTObjects.ExtractFile( Me.LocalFileName )

spricht 100% gegen ein OLE Objekt, sondern für ein Attachment.

Du solltest mal den Debugger laufen lassen und Dir die Eigenschaften von RTObjects ansehen.

Ich glaube der Fehler tritt woanders auf. oder hast Du Step by Step den Debugger laufen lassen und der ist an der Stelle
Call RTObjects.ExtractFile( Me.LocalFileName )
herausgeflogen?

Andreas
Titel: Re: automation object member not found
Beitrag von: flaite am 28.07.05 - 17:25:27
Automation Object Member not found ist eine OLE Fehlermeldung soweit ich weiss. Keine Notes Fehlermeldung.
Titel: Re: automation object member not found
Beitrag von: BKreplin am 28.07.05 - 17:27:08
Ja, ich habe mit dem Step by Step Debugger festgestellt, dass ExtractFile den Fehler hervorruft.
Titel: Re: automation object member not found
Beitrag von: Glombi am 28.07.05 - 17:27:32
Automation Object Member not found ist eine OLE Fehlermeldung soweit ich weiss. Keine Notes Fehlermeldung.
Ja klar, aber dann verstehe ich den Codeschnipsel nicht, den er oben angeführt hat.

Diese Meldung kenne ich auch nur im Zusammenhang mit OLE und COM Objekten.

Aber wenn wir hier nur ein paar Zeilen bekommen, können wir lang und breit spekulieren.

Andreas
Titel: Re: automation object member not found
Beitrag von: flaite am 28.07.05 - 17:30:08
Ich find spekulieren eigentlich auch ganz interessant.

Zur Frage COM oder OLE kann ich sagen, dass die bewusste Session mit

Set Me.session = New NotesSession
Set Me.workspace = New NotesUIWorkspace
Set Me.uidoc = workspace.CurrentDocument

eingerichtet wird.

Das spricht für OLE.
Nö. Das spricht wiederum für com. Wo liegt dieser Code? In einem NotesAgenten/Scriptlibrary oder ausserhalb von Notes?
Titel: Re: automation object member not found
Beitrag von: BKreplin am 28.07.05 - 17:38:35
1. Es geht um ein Attachment
2. der Code liegt in der Scriptlibrary

Declare Function GetTempFileNameA Lib "Kernel32" (Byval lpszPath As String, Byval lpPrefixString As String, Byval wUnique As Integer, Byval lpTempFileName As String) As Long
Declare Function GetTempFileName Lib "Kernel" (Byval cDriveLetter As Integer, Byval lpPrefixString As String, Byval wUnique As Integer, Byval lpTempFileName As String) As Integer
Declare Function GetTempDrive Lib "Kernel" (Byval cDriveLetter As Integer) As Integer

Declare Function FindWindowA Lib "user32" (Byval lpClassName As String, Byval lpWindowName As String) As Long
Declare Function SetActiveWindow Lib "user32" (Byval hwnd As Long) As Integer

Declare Function RegCloseKey Lib "advapi32.dll" (Byval hKey As Long) As Long
Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (Byval hKey As Long, Byval lpSubKey As String, Byval ulOptions As Long, Byval samDesired As Long, phkResult As Long) As Long
Declare Function RegQueryValueExString Lib "advapi32.dll" Alias "RegQueryValueExA" (Byval hKey As Long, Byval lpValueName As String, Byval lpReserved As Long, lpType As Long, Byval lpData As String, lpcbData As Long) As Long
Declare Function RegQueryValueExLong Lib "advapi32.dll" Alias "RegQueryValueExA" (Byval hKey As Long, Byval lpValueName As String, Byval lpReserved As Long, lpType As Long, lpData As Long, lpcbData As Long) As Long
Declare Function RegQueryValueExNULL Lib "advapi32.dll" Alias "RegQueryValueExA" (Byval hKey As Long, Byval lpValueName As String, Byval lpReserved As Long, lpType As Long, Byval lpData As Long, lpcbData As Long) As Long
Const REG_SZ  = 1
Const REG_DWORD = 4

Const HKEY_CLASSES_ROOT = &H80000000
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
Const HKEY_USERS = &H80000003

Const ERROR_NONE = 0
Const ERROR_BADDB = 1
Const ERROR_BADKEY = 2
Const ERROR_CANTOPEN = 3
Const ERROR_CANTREAD = 4
Const ERROR_CANTWRITE = 5
Const ERROR_OUTOFMEMORY = 6
Const ERROR_INVALID_PARAMETER = 7
Const ERROR_ACCESS_DENIED = 8
Const ERROR_INVALID_PARAMETERS = 87
Const ERROR_NO_MORE_ITEMS = 259

Const KEY_READ = &H19
Const KEY_ALL_ACCESS = &H3F
Const REG_OPTION_NON_VOLATILE = 0
Const DEBUGMODEScriptLibrary = False
Public Class twCompScan
   
     ' #################################################################################################
     '
     ' Member Variables
     '
     ' #################################################################################################
   
   Private ScanOLEObjectName As String          ' Name of object to create for using
   Private ScanOLEObjectFileName As String      ' Name of File Object to generate for loading
   
   Private ScanObject As Variant                ' Handle to automation object
   Private LocalFileName As String              ' File name of attachment when saving it to the local harddisk
   Private InternalFileNameDefault As String    ' Default File name of attachment in current document: scan.tif
   Private InternalFileName As String           ' File name of attachment in current document, usually scan.tif, set in New sub
   Private InternalRTItemName As String         ' Name of rich text field containing the attachment, usually twCompScanBody, set in New sub
   Private InternalOCRItemName As String        ' Name of rich text field containing the OCR'ed text, usually twCompScanBodyText, set in New sub
   Private session As NotesSession
   Private UiDoc As NotesUiDocument
   Private Workspace As NotesUiWorkspace
   Private DebugMode As String
   
     ' #################################################################################################
     '
     ' Internal Functions
     '
     ' #################################################################################################
   
   
   Private Function DisplayError ( displayText As String ) As Integer
          ' call the internal error handling functions
          ' Messagebox displayText, MB_OK + MB_ICONEXCLAMATION, str_twCScanErrorHeader
      Print str_twCScanErrorHeader & ": " & displayText
      DisplayError = True
   End Function
   
   Private Sub DisplayStatus ( displayText As String )
      If Me.DebugMode = "1" Then Print ( displayText & str_twCScanErrorPlace  )
   End Sub
   
   Private Function RaiseError ( method As String ) As Integer
          ' Checks to see if the object produced an error or not.
          ' method: String containing method name to display
      
      DisplayStatus ( "twCompScan.RaiseError" )
      
      If ( Me.ScanObject.ReturnCode() <> 0) Then
         Call DisplayError ( method & ": " & Me.ScanObject.ReturnMessage() )
         RaiseError = True
      Else
         RaiseError = False
      End If
   End Function
   
   
     ' #################################################################################################
     '
     ' External Functions
     '
     ' #################################################################################################
   
   Public Sub New ( Byval RTItemName As String, Byval OCRItemName As String, Byval FileName As String )
          ' Constructor for setting different variables, determing the path where Watermark is installed,
          ' setting global member variables for current NotesSession, NotesUiWorkspace, NotesUiDocument
          ' RTItemName: String containing the name of the rich text item with the attachment
          ' OCRItemName: String containing the name of the rich text item with the  OCR'ed text
          ' Filename: String containing the file name of the attachment
      
          ' Set default values
      Stop
      ScanOLEObjectName = "AcroExch.App"
      ScanOLEObjectFileName = "AcroExch.PDDoc"
      
      Me.InternalFileNameDefault = "scan.pdf"
      If RTItemName = "" Then
         Me.InternalRTItemName = "twCompScanBody"
      Else
         Me.InternalRTItemName = RTItemName
      End If
      
      Dim sKeyName As String
      Dim sValueName As String
      
      Dim ret As Integer
      Dim regObject As New twRegistry
      
      sKeyName = "AcroExch.App"
      sValueName = "(Standard)"
      
      If OCRItemName = "" Then
         Me.InternalOCRItemName = "twCompScanBodyText"
      Else
         Me.InternalOCRItemName = OCRItemName
      End If
      
      Set Me.session = New NotesSession
      Set Me.workspace = New NotesUIWorkspace
      Set Me.uidoc = workspace.CurrentDocument
      
          ' Check Debug Mode
      Me.DebugMode = Me.session.GetEnvironmentString ( "twCompScanAcrobatDebugMode" )
      
          ' Get installation path
      On Error Resume Next
      sKeyName = "AcroExch.App"
      ret= regObject.QueryKeyExists ( HKEY_CLASSES_ROOT, sKeyName )         
      
      If ret = False Then
         Call Me.UiDoc.Document.ReplaceItemvalue ( "twCompScanInstalled", "0" )
         Call DisplayError ( str_twCScanErrorMissing )
         Call Me.UiDoc.RefreshHideFormulas ()
         Exit Sub
      Else
         Call Me.UiDoc.Document.ReplaceItemvalue ( "twCompScanInstalled", "1" )               
      End If
      
      Me.LocalFileName = ""
      Me.InternalFileName = fileName
      
          ' Identify attachment
      Dim doc As NotesDocument
      Dim rtItem As NotesRichTextItem
      
      Set doc = Me.UiDoc.Document
      Set rtItem = doc.GetFirstItem ( Me.InternalRTItemName )
      If rtItem.Type = RICHTEXT Then
         Forall RTObjects In rtItem.EmbeddedObjects
            If ( RTObjects.Type = EMBED_ATTACHMENT ) Then
               Me.InternalFileName = RTObjects.Name
               Exit Forall
            End If
         End Forall
      End If
      
          ' Get temporary filename
      Dim tempPath As String
      Dim tempFileName As String * 256
      Dim tempNewName As String
      
      tempPath = Environ$ ( "TEMP" )
      If Mid ( tempPath, Len(tempPath), 1 ) <> "\" Then
         tempPath = tempPath & "\"
      End If
      
      ret = GetTempFileNameA ( tempPath, "tws", 0, tempFileName )
      tempFileName = Left ( tempFileName, Instr ( tempFileName, Chr (0) ) - 1 )
      
      On Error Goto ErrorRename
      
      tempNewName = Strleft ( tempFileName, "." )
      tempNewName = tempNewName + ".pdf"
      
      Name tempFileName As tempNewName
      Me.LocalFileName = tempNewName
      
      Call Me.UiDoc.RefreshHideFormulas ()
      
      Exit Sub
      
ErrorRename:
      Call DisplayError ( str_twCScanErrorRename )
      Call Me.UiDoc.Document.ReplaceItemvalue ( "twCompScanInstalled", "0" )
      Call Me.UiDoc.RefreshHideFormulas ()
      Exit Sub
      
   End Sub
   
     ' #################################################################################################
   
   Public Sub Delete
          ' Shut down scan software if not already done
      Dim ScanObjectAVDoc As Variant
      Dim numberOfDocs As Long
      Dim i As Long
      
      DisplayStatus ( "twCompScan.Delete")
      
      On Error Resume Next
      If (Not Isempty( Me.ScanObject )) Then
         
         numberOfDocs = Me.ScanObject.GetNumAVDocs
         For i = 1 To numberOfDocs
            Set ScanObjectAVDoc = Me.ScanObject.GetActiveDoc
            Call ScanObjectAVDoc.Close (True)
         Next
         
         Me.ScanObject.Exit
         Set Me.ScanObject = Nothing     ' shut down scan software
      End If
      Kill Me.LocalFileName
   End Sub
   
     ' #################################################################################################
   
   Public Function Launch (bShowWindow As Integer)
          ' If not already done, create a OLE object and store it in Me.ScanObject
          ' bShowWindow: Boolean parameter, indicating whether the scan window
          ' should be displayed or not
      
      DisplayStatus ( "twCompScan.Launch")
      
      On Error Goto ErrorLocal
      
      If ( Isempty(Me.ScanObject) ) Then
         Set Me.ScanObject = CreateObject( ScanOLEObjectName )
      End If
      
      If (bShowWindow) Then
         Me.ScanObject.Show
         Me.ScanObject.Restore (True)
      End If
      Launch =  True
      Exit Function
      
ErrorLocal:
      Call DisplayError ( str_twCScanErrorLaunch )
      Launch = False
      Exit Function
   End Function
   
     ' #################################################################################################
   
   Public Function Open As Integer
          ' Display the "Open Document" Dialogbox to the user and let him choose a file
      
      Dim numberOfDocs As Long
      
      DisplayStatus ( "twCompScan.Open" )
      
      On Error Goto ErrorLocal
      
      Call Me.Launch ( True )
      
      numberOfDocs = Me.ScanObject.GetNumAVDocs
      Me.ScanObject.Restore (True)
      Me.ScanObject.MenuItemExecute "Open"                    ' prompt user for existing document
      Doevents
      
      If (numberOfDocs = Me.ScanObject.GetNumAVDocs) Then
         DisplayError ( str_twCScanErrorOpen  )
         Me.Open = False
         Exit Function
      End If
      
      Me.Open = True
      Exit Function
      
ErrorLocal:
      Call DisplayError ( str_twCScanErrorOpen & Error$ )
      Me.Open = False
      Exit Function
      
   End Function
   
     ' #################################################################################################
   
   Public Function Print As Integer
          ' Prints the current document in the window on the default printer
      
      DisplayStatus ( "twCompScan.Print" )
      On Error Goto ErrorLocal
      
      Dim ScanObjectAVDoc As Variant
      Dim ScanObjectPDDoc As Variant
      Dim numPages As Long
      
      Set ScanObjectAVDoc = Me.ScanObject.GetActiveDoc
      Set ScanObjectPDDoc = ScanOBjectAVDoc.GetPDDoc
      numPages = ScanObjectPDDoc.GetNumPages
      
      If (Not ScanObjectAVDoc.PrintPagesSilent (0, numPages - 1, 0, False, True)) Then
         Me.Print = False
         Exit Function
      End If
      
      Me.Print = True
      Exit Function
      
ErrorLocal:
      Call DisplayError ( str_twCScanErrorPrint & Error$ )
      Me.Print = False
      Exit Function
   End Function
   
     ' #################################################################################################
   
   Public Function Save As Integer         
          ' Save the current image on local hard disk
      
      Dim ScanObjectAVDoc As Variant
      Dim ScanObjectPDDoc As Variant
      
      DisplayStatus ( "twCompScan.Save" )
      
      On Error Goto ErrorLocal
      
      If ( Isempty (ScanObject) ) Then
         Exit Function
      End If
      
      Set ScanObjectAVDoc = Me.ScanObject.GetActiveDoc
      Set ScanObjectPDDoc = ScanOBjectAVDoc.GetPDDoc
      
          ' save file with all pages and overwrite any existing file
      If ( ScanObjectPDDoc.Save ( 1, Me.LocalFileName ) ) Then
         Call Me.UiDoc.Document.ReplaceItemValue ( "twCompScanDoSave", "1" )
         Me.Save = True
      Else
         Me.Save = False
      End If
      
      Exit Function
      
ErrorLocal:
      Call DisplayError ( str_twCScanErrorSave & Error$ )
      Save = False
      Exit Function
      
   End Function
   
     ' #################################################################################################
   
   Public Function SaveNotes As Integer
          ' Transfer the current image fromlocal hard disk to the document     
      
      Dim doc As NotesDocument
      Dim rtItem As NotesRichTextItem
      Dim tempItemValue As Variant
      
      DisplayStatus ( "twCompScan.SaveNotes" )
      
      On Error Goto ErrorLocal
      
      Set doc = Me.UiDoc.Document
      SaveNotes = True
      
      tempItemValue = doc.GetItemValue ( "twCompScanDoSave" )
      If tempItemValue(0) <> "1" Then
         Exit Function
      End If
      
      Call doc.removeitem( Me.InternalRTItemName )
      Call doc.removeItem ( "twCompScanDoSave" )
      Set rtitem = New NotesRichTextItem( doc, Me.InternalRTItemName )
      Call rtItem.AppendText ( " " )            ' Needed to display the embedded object
                                                    ' at the right position
      Call rtitem.EmbedObject ( EMBED_ATTACHMENT, "", Me.LocalFileName, Me.InternalFileName )
      Call doc.Save ( True, True )
      
      Exit Function
      
ErrorLocal:
      Call DisplayError ( str_twCScanErrorSaveNotes & Error$ )
      SaveNotes = False
      Exit Function
      
   End Function
   
     ' #################################################################################################
   
   Public Function Load As Integer
          ' Load the file which is saved in the current NotesDocument into Watermark
      
      Dim doc As NotesDocument
      Dim rtItem As NotesRichTextItem
      Dim ScanObjectAVDoc As Variant
      Dim retCode As Variant
      
      DisplayStatus ( "twCompScan.Load" )
      
      On Error Goto ErrorLocal
      
      Call Me.Launch ( True )
      
      Set doc = Me.UiDoc.Document
      Set rtItem = doc.GetFirstItem ( Me.InternalRTItemName )
      If rtItem.Type = RICHTEXT Then
         Forall RTObjects In rtItem.EmbeddedObjects
            If ( RTObjects.Type = EMBED_ATTACHMENT ) Then
               Call RTObjects.ExtractFile( Me.LocalFileName )
               Exit Forall
            End If
         End Forall
      End If
      
      retCode = Me.ScanObject.CloseAllDocs
      
      Set ScanObjectAVDoc = CreateObject ( "AcroExch.AVDoc" )
      retCode = ScanObjectAVDoc.Open ( Me.LocalFileName,  "" )         
      Set ScanObjectAVDoc = Me.ScanObject.GetActiveDoc
      
      If ( retCode ) Then
         Load = True
         Exit Function
      End If
      
ErrorLocal:
      Call DisplayError ( str_twCScanErrorLoad & Error$ )
      Load = False
      Exit Function
      
   End Function
   
     ' #################################################################################################
   
   Public Function Scan As Integer
          ' Scan all pages in automatic feeder (or one page w/o ADF) into the current document
      
      Dim retCode As Long
      Dim ScanObjectAVDoc As Variant
      Dim ScanObjectPDDoc As Variant
      Dim numPages1 As Long
      Dim numPages2 As Long
      
      DisplayStatus ( "twCompScan.Scan" )
      
      Call Me.Launch ( True )
      
      On Error Resume Next                      ' ignore exceptions
      
      Set ScanObjectAVDoc = Me.ScanObject.GetActiveDoc
      Set ScanObjectPDDoc = ScanOBjectAVDoc.GetPDDoc
      numPages1 = ScanObjectPDDoc.GetNumPages
      
      Me.ScanObject.Restore (True)
      retCode = Me.ScanObject.MenuItemExecute ( "Scan" )
      Doevents
      
      Set ScanObjectAVDoc = Me.ScanObject.GetActiveDoc
      Set ScanObjectPDDoc = ScanOBjectAVDoc.GetPDDoc
      numPages2 = ScanObjectPDDoc.GetNumPages
      
      If (numPages1 = numPages2) Then
         DisplayError ( str_twCScanErrorScan )
         Scan = False
         Exit Function   
      Else
         Scan = True         
      End If
      
      
   End Function
   
     ' #################################################################################################
   
   Public Function OCR As Integer
          ' OCR's the current document
      
      Dim retCode As Long
      Dim ScanObjectAVDoc As Variant
      
      Dim AcrobatWindowTitle As String
      Dim AcrobatWindowHandle As Long
      
      DisplayStatus ( "twCompScan.OCR" )
      On Error Goto ErrorLocal
      
          ' Activate window of scan modul by finding it with win32 functions
      
      Set ScanObjectAVDoc = Me.ScanObject.GetActiveDoc ()
      AcrobatWindowTitle = ScanObjectAVDoc.GetTitle ()
      AcrobatWindowHandle = FindWindowA ( "", AcrobatWindowTitle )
      Call SetActiveWindow ( AcrobatWindowHandle )
      
      retCode = Me.ScanObject.MenuItemExecute ( "Cpt:CapturePages" )
      
      Me.OCR = True
      Exit Function
      
ErrorLocal:
      Call DisplayError ( str_twCScanErrorOcr & Error$ )
      Me.OCR = False
      Exit Function
   End Function
   
     ' #################################################################################################
   
   Public Function OCRText As Integer
          ' Put the OCR'ed text in a field of the current document
      
      Dim ScanObjectAVDoc As Variant
      Dim ScanObjectPDDoc As Variant
      Dim ScanObjectAVPageView As Variant
      Dim numPages As Long
      Dim i As Long
      
      DisplayStatus ( "twCompScan.OCRText" )
      
      Set ScanObjectAVDoc = Me.ScanObject.GetActiveDoc
      Set ScanObjectPDDoc = ScanOBjectAVDoc.GetPDDoc
      Set ScanObjectAVPageView = ScanObjectAVDoc.GetAVPageView
      numPages = ScanObjectPDDoc.GetNumPages
      
      Me.UiDoc.EditMode = True
      If Me.UiDoc.EditMode = False Then
         Call DisplayError ( str_twCScanErrorOcrTextNoEdit )
         Me.OcrText = False
         Exit Function
      Else               
         Call Me.uiDoc.GotoField ( Me.InternalOCRItemName )
         For i = 0 To numPages - 1
            Call ScanObjectAVPageView.Goto (i)
            Call Me.ScanObject.MenuItemExecute ( "SelectAll")
            Call Me.ScanObject.MenuItemExecute ( "Copy")
            Call Me.uiDoc.Paste ()
         Next
         Me.OcrText = True
      End If
      
      Exit Function
      
ErrorLocal:
      Call DisplayError ( str_twCScanErrorOcrTextCopy & Error$ )
      Me.OCRText = False
      Exit Function
      
   End Function
End Class
Titel: Re: automation object member not found
Beitrag von: BKreplin am 28.07.05 - 17:41:24
P.S.

Dies ist der Code hinter der Schaltfläche:

Sub Click(Source As Button)
   
   Dim thisScanObject As twCompScan
   Set thisScanObject = New twCompScan ( "twCompScanBody", "twCompScanBodyText", "twS" )
   
   '1: Aktuelles Scan-Dokument öffnen
   Call ThisScanObject.Load
   '2: Erkannten Text übernehmen
   Call ThisScanObject.OCRText
   
End Sub
Titel: Re: automation object member not found
Beitrag von: koehlerbv am 28.07.05 - 18:08:59
Es ist also OLE, und ich kann mir nicht vorstellen, dass der Fehler in der von Dir angegebenen Zeile tatsächlich auftritt:

Code
      Set ScanObjectAVDoc = CreateObject ( "AcroExch.AVDoc" )
      retCode = ScanObjectAVDoc.Open ( Me.LocalFileName,  "" )         
      Set ScanObjectAVDoc = Me.ScanObject.GetActiveDoc

Das Problem liegt also an irgendwelchen Änderungen in Acrobat 7: Der Registry-Eintrag müsste jetzt anders heissen als "AcroExch.AVDoc", oder eine Methode oder Property des Adobe-Objects heisst jetzt anders oder ... Das ExtractFile selbst kann diese Fehlermeldung jedenfalls nicht verursachen, da das nix mit OLE zu tun hat (hier mag jetzt aber auch Notes "spinnen", was die Zeilenangabe im Debugger angeht).

Bernhard
Titel: Re: automation object member not found
Beitrag von: Glombi am 28.07.05 - 18:09:24
Also OLE/COM Objekt, welches in der Registry eingetragen ist.

Was sagt denn der Debugger zu
Me.LocalFileName

Was steht in "LocalFileName"?
Titel: Re: automation object member not found
Beitrag von: koehlerbv am 28.07.05 - 18:15:02
Mir ist auch vollkommen unklar, warum man das alles in eines Objekt gepackt hat - vererbte Notes-Dokumente, Infos für Acrobat usw. Das könnte auch erklären, warum das dann ein einer "völlig unmöglichen Stelle" knallt.

Bernhard
Titel: Re: automation object member not found
Beitrag von: BKreplin am 28.07.05 - 18:23:29
Da hab ich ja eine heisse Diskussion losgetreten. Nochmals herzlichen Dank für Eure Beiträge.

Warum was wie ist, kann ich nicht sagen. Wir haben das Dokumentenmanagement-System gekauft. Es wird jedoch vom Lieferanten nicht mehr gepflegt/betreut. Bin schon froh, dass ich die Fehlerquelle doch relativ eng eingrenzen konnte. Im Debugger kommt die Fehlermeldung ganz eindeutig beim ExtractFile. Ob der spinnt??

Als nächstes werde ich versuchen, die Registry zu verstehen.
Titel: Re: automation object member not found
Beitrag von: BKreplin am 28.07.05 - 18:29:23
P.S.

In Me.LocalFileName steht für meine Begriffe völlig korrekt der Path C:\Dokumente und Einstellungen\Kreplin\Lokale Einstellungen\Temp\irgendwas.pdf

Wenn der Debugger nach der Ausführung von ExtractFile den Fehler anzeigt, kann ich irgendwas.pdf im Verzeichnis auch sehen. Beim versuchsweisen Öffnen kommt die Fehlermeldung sinngemäß PDF-Datei defekt.

Gehe ich jedoch im Notes-Dokument mit der rechten Maus-Taste auf das Attachment, bekomme ich mit Anzeige oder Öffnen das File korrekt angezeigt. Hier kann ich jedoch nicht den OCR-Text sehen, den die Schaltfläche mir liefern soll.
Titel: Re: automation object member not found
Beitrag von: flaite am 28.07.05 - 18:29:48
@Brigitte: Die Fehlermeldung ist nicht besonders hilfreich.


Andere Hypothese: AcroExch.AVDoc erwartet eine andere Version von AcroExch.App als die die da ist.
Titel: Re: automation object member not found
Beitrag von: BKreplin am 28.07.05 - 18:35:26
OK, wo bekomme ich Updates her und wo speichere ich diese ab.

Tut mir leid, vielleicht nicht grade eine schlaue Frage. Ich installiere meine Programme nicht selbst, das macht ein Kollege, der z.Zt. krank ist. Ich kann dafür mit dem Designer umgehen, entwickle aber nicht selbst, sondern bin hier nur das Notfallkommando.
Titel: Re: automation object member not found
Beitrag von: flaite am 28.07.05 - 23:02:15
OK, wo bekomme ich Updates her und wo speichere ich diese ab.

Tut mir leid, vielleicht nicht grade eine schlaue Frage. Ich installiere meine Programme nicht selbst, das macht ein Kollege, der z.Zt. krank ist. Ich kann dafür mit dem Designer umgehen, entwickle aber nicht selbst, sondern bin hier nur das Notfallkommando.
So einfach ist dieser Fall vermutlich nicht.
Professionelle Unterstützung macht schon manchmal Sinn (keine Eigenwerbung, weil ich eh kein COM-Experte bin, sondern Notes, Java, J2EE, Websphere, JBoss, Springframework).

Noch was: Ist in dem RichText Feld ein Attachment oder vielleicht ein eingebettetes Objekt. Falls eingebettetes Objekt, dann hat dieser Fehler vielleicht gar nichts mit dieser gesamten Diskussion zu tun, sondern check Notes Doku: Call notesEmbeddedObject.ExtractFile( path$ ).
In einem Projekt standen wir mal selber vor dem Problem und ein Kollege musste entsprechend C-Code schreiben, um aus eingebetteten Objekten das File zu extrahieren.

Im übrigen ist dieses Forum auch einfach nicht als Substitution für umfassende, professionelle Unterstützung vor Ort gedacht. Manchmal wird es einfach zu komplex und das kann an verschiedenen Sachen liegen.

Gruß Axel
Titel: Re: automation object member not found
Beitrag von: koehlerbv am 28.07.05 - 23:22:45
Hallo Axel,

NotesEmbeddedObject.ExtractFile wirkt nur für Attachments. OLE-Objekte sind aussen vor bei dieser Methode, und der bestehende Code prüft vorab auch brav, ob es sich denn um ein Attachment handelt.

Ansonsten stimme ich Dir vollkommen zu. Wenn Brigitte schon schreibt, sie sei das "Notfallkommando", so sind die Karten dort echt übel gemischt. So spannend ich diese Frage auch sehe, aber derartige Probleme sind aus der Ferne nur sehr schwer lösbar. Hier gehört ein Fachmann vor Ort hin, der nur so den Gesamtzusammenhang eruieren und dann das Problem lösen kann.

Brigitte: Ich sehe noch eine Chance, dies innerhalb der AtNotes-Community zu lösen - wenn Du ie Codeabarbeitung Zeile für Zeile im Debugger ablaufen lässt und dabei die Belegung der Objekte und Variablen beobachtest UND dabei etwas verdächtiges findest. Ideal wäre, wenn Du dies auf zwei Kisten machen könntest: Eine mit der vorigen, eine mit der letzten Acrobat-Installation.

Noch ein ganz pragmatischer Vorschlag - wenn dem andere wichtige Gründe nicht entgegen sprechen: Wenn Euch der Produzent der gegenwärtigen Software weggebrochen ist, haut Acrobat 7 wieder in die Tonne, installiert die letzte funktionierende Version (mit der funktionieren ja auch fast alle PDF-Files), und sucht Euch in Ruhe Ersatz für einen professionellen Supporter.

Good luck,
Bernhard
Titel: Re: automation object member not found
Beitrag von: flaite am 29.07.05 - 01:08:52
Hallo Axel,

NotesEmbeddedObject.ExtractFile wirkt nur für Attachments. OLE-Objekte sind aussen vor bei dieser Methode, und der bestehende Code prüft vorab auch brav, ob es sich denn um ein Attachment handelt.
Code
Das meinte ich auch. Unser Code hat vor dem Aufruf der Methode geprüft, ob es ein eingebettetes OLE-Objekt ist und dann wurde der C-Code aufgerufen. 

Eigentlich auch eine Binsenweisheit, aber die Komplexität kommt oft durch das Zusammenspiel verschiedener Komponenten. Acrobat, OLE-Automation, etc. schaffen einfach einen leicht veränderten Kontext und dann gelten wieder leicht andere Regeln. 
Und wenn man die Regeln der einzelnen Bausteine nicht versteht, kommt man leicht zu falschen Ergebnissen. 

Manche IT-Probleme sind schnell gefixt. Andere sind wirklich mehr wie komplexere Schachpartien (oder besser Go/Weiqui/Baduk-Matches). Meine Kunden verstehen aber oft auch nicht, warum jetzt ein bestimmtes Problem besser wie ein schwieriger Angriff auf ein von fremden Steinen beherrschtes Gebiet in Go/Weiqi/Baduk angegangen werden muß. Komplex. 

Axel [/quote]
Titel: Re: automation object member not found
Beitrag von: BKreplin am 29.07.05 - 09:20:47
Ihr habt ja alle Recht, ab einem bestimmten Punkt ist professionelle Hilfe angebracht. Nur konnte ich nicht von Anfang an beurteilen, dass der Fall so komplex ist. Ich bedanke mich nochmals für Eure Unterstützung und beende hiermit die Diskussion.