Outlook 2007 per Autoit öffnen

  • Hallo leute,

    ich bin relativ neu und möchte gerne ein Autoit Script Outlook steuern. Dabei habe ich die Outlook UDF gefunden, aber der Quellcode schafft es nichtmal Outlook zu öffnen. Ich denke ganz erlich dass der Fehler aber nicht vom Quellcode kommt . ;(
    Deshalb bitte ich um Hilfe. Der Quellcode ist:


    Func _OutlookOpen()
    Local $oOutlook = ObjCreate("D:\Program Files (x86)\Microsoft Office\Office12\Outlook.Application")
    If @error Or Not IsObj($oOutlook) Then
    Return SetError(1, 0, 0)
    EndIf
    Return $oOutlook
    EndFunc

    Ich danke euch schon im vorraus ;)

    Einmal editiert, zuletzt von Xplosio (2. Januar 2013 um 21:16)

  • Hi,
    ich benutze kein Outlook und habe es auch von allen unseren Rechnern entfernt, was aber definitiv nicht stimmt, ist dass die Zeile

    [autoit]

    Local $oOutlook = ObjCreate("D:\Program Files (x86)\Microsoft Office\Office12\Outlook.Application")

    [/autoit]


    aus der Outlook.udf kommt!
    Wenn du bestehende funktionierende Scripte änderst und dich wunderst, dass diese danach nicht (mehr) funktionieren, hilft es auch nicht, die Leute hier im Forum vorwurfsvoll nach Lösungen für das von DIR verursachte Problem zu drängen!

  • das stimmt D:\Program Files (x86)\Microsoft Office\Office12\Outlook.Application kam nicht vom udf aber dass DU dass als schlechtes benehmen interpretierst und mir diese Zitate auf den Kopf wirfst find ich schon dreist. Denn ich habe das nur geändert, weil Local $oOutlook = ObjCreate("Outlook.Application") nicht funktioniert hat und wenn du keine Lösung hast dann bitte ich dich nicht mehr in diesem Topic zu schreiben, auf sowas kann ich verzichten!

  • Du könntest auch einfach mit "Run" Outlook starten und dann mit der UDF weiterarbeiten!

    [autoit]


    Run("D:\Program Files (x86)\Microsoft Office\Office12\OUTLOOK.EXE")

    [/autoit]

    Und noch was:

    Falls es dir nicht passt, das du ein wenig auf eine Antwort warten musst, dann geh doch in ein anderes Forum. :thumbdown:
    Nur hier wirst du wohl die besten Antworten zu AutoIt-Fragen auf Deutsch bekommen!
    Du kannst es ja auch mal im englischen Forum probieren.

    Mfg

    There's a joke that C has the speed and efficieny of assembly language combined with readability of....assembly language. In other words, it's just a glorified assembly language. - Teh Interwebz

    C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, you blow off your whole leg. - Bjarne Stroustrup
    Genie zu sein, bedeutet für mich, alles zu tun, was ich will. - Klaus Kinski

    Einmal editiert, zuletzt von PainTain (2. Januar 2013 um 17:47)

    • Offizieller Beitrag

    und mir diese Zitate auf den Kopf wirfst find ich schon dreist.


    Wäre nicht schlecht, wenn du lesen lernst! Was du dort als dir geltende Zitate interpretierst ist einfach nur die Signatur von Andy - das steht dort also IMMER!

    Vor Inbetriebnahme des Mundwerks (bzw. hier der Schreibgriffel) - Gehirn einschalten!

  • Ok scheint so als ob ich es falsch interpretiert habe, diesbezüglich bitte ich um Entschuldigung und ich denke das alles sinnlos eskaliert ist, dementsprechen würde ich nochmal einfach bitten mir zu helfen bzw. wenn die Lösung wo anders ist mir einfach ein Link schickt, da ich wirklich gerne was neues im Forum Posten würde und nicht etwas was schon gelöst worden ist. Bevor jemand sagt, dass ich selber suchen soll, möchte ich Erwähnen, dass ich habe bereits gesucht, jedoch gab es nichts was mir wirklich hilft, da wie bereits o.g. ich mich nicht sehr mit Autoit auskenne.

  • Kann es sein, dass du auf deinem Rechner garkein Outlook hast, sondern Outlook Express?
    Trotz ähnlichem Namen sind das zwei völlig verschiedene Programme.

    Hab mich eben mal auf einen Rechner eingeloggt, auf dem Outlook läuft, die UDF funktioniert einwandfrei.

  • Offensichtlich verwendest Du das OutlookUDF (nicht OutlookEX-UDF), stimmts?

    Dein Beispiel scheint aus Outlook.au3 zu sein. Diese stellt zunächst ersteinmal die Verbindung zu Outlook her.
    Hier der Auszug aus der Outlook.au3 dazu:

    [autoit]


    ;===============================================================================
    ;
    ; Function Name: _OutlookOpen()
    ; Description: Open a connection to Microsoft Outlook.
    ; Syntax.........: _OutlookOpen()
    ; Parameter(s): None
    ; Requirement(s): AutoIt3 with COM support (post 3.1.1)
    ; Return Value(s): On Success - Returns new object identifier
    ; On Failure - Returns 0 and sets @ERROR > 0
    ; @ERROR = 1 - Unable to Create Outlook Object.
    ; Author(s): Wooltown
    ; Created: 2009-02-09
    ; Modified: -
    ;
    ;===============================================================================
    Func _OutlookOpen()
    Local $oOutlook = ObjCreate("Outlook.Application")
    If @error Or Not IsObj($oOutlook) Then
    Return SetError(1, 0, 0)
    EndIf
    Return $oOutlook
    EndFunc
    ;===============================================================================
    ;
    ; Function Name: _OutlookSendMail()
    ; Description: Send an email using Microsoft Outlook.
    ; Syntax.........: _OutlookSendMail($oOutlook, $sTo = "", $sCc = "", $sBCc = "", $sSubject = "", $sBody = "", $sAttachments = "", $iBodyFormat = $olFormatUnspecified, $iImportance = $olImportanceNormal, $sWarningClick = "")
    ; Parameter(s): $oOutlook - Outlook object opened by a preceding call to _OutlookOpen()
    ; $sTo - Optional: The recipiant(s), separated by ;
    ; $sCc - Optional: The CC recipiant(s) of the mail, separated by ;
    ; $sBCc - Optional: The BCC recipiant(s) of the mail, separated by ;
    ; $sSubject - Optional: The Subject of the mail
    ; $sBody - Optional: The Body of the mail
    ; $sAttachments - Optional: Attachments, separated by ;
    ; $iBodyFormat - Optional: The Bodyformat of the mail, default = $olFormatUnspecified
    ; $iImportance - Optional: The Importance of the mail, default = $olImportanceNormal
    ; $sWarningClick - Optional: The Entire SearchString to 'OutlookWarning1.exe', Default = None
    ; Requirement(s): AutoIt3 with COM support (post 3.1.1)
    ; Return Value(s): On Success - Returns 1
    ; On Failure - Returns 0 and sets @ERROR > 0
    ; @ERROR = 1 - No To, Cc or BCc specified.
    ; @ERROR = 2 - OutlookWarning1.exe not found.
    ; @ERROR = 9 - ObjEvent error.
    ; Author(s): Wooltown
    ; Created: 2009-02-09
    ; Modified: 2009-02-24 - Several attachments didn't work
    ;
    ;===============================================================================
    Func _OutlookSendMail($oOutlook, $sTo = "", $sCc = "", $sBcc = "", $sSubject = "", $sBody = "", $sAttachments = "", $iBodyFormat = $olFormatPlain, $iImportance = $olImportanceNormal, $sWarningClick = "")
    Local $iRc = 0, $asAttachments
    If $sTo = "" And $sCc = "" And $sBCc = "" Then
    Return SetError(1, 0, 0)
    EndIf
    If $sWarningClick <> "" And FileExists($sWarningClick) = 0 Then
    Return SetError(2, 0, 0)
    Else
    Run($sWarningClick)
    EndIf
    Local $oOuError = ObjEvent("AutoIt.Error", "_OutlookError")
    Local $oMessage = $oOutlook.CreateItem($olMailItem)
    With $oMessage
    .To = $sTo
    .Cc = $sCc
    .Bcc = $sBCc
    .Subject = $sSubject
    .Body = $sBody
    .BodyFormat = $iBodyFormat
    .Importance = $iImportance
    If $sAttachments <> "" Then
    $asAttachments = StringSplit($sAttachments,";")
    For $iNumOfAttachments = 1 to $asAttachments[0]
    .Attachments.Add($asAttachments[$iNumOfAttachments])
    Next
    EndIf
    .Send
    $iRc = @ERROR
    EndWith
    If $iRc = 0 Then
    Return 1
    Else
    Return SetError(9, 0, 0)
    EndIf
    EndFunc
    ;===============================================================================

    [/autoit]

    Was soll denn dann passieren?

    Am Beispiel einer E-Mail könnte das exemplarisch so aussehen (hier mit HTML-Body):

    [autoit]


    #include <Outlook.au3>
    $oOutlook = _OutlookOpen()
    _OutlookSendMail($oOutlook, empfä[email='nger@mail.com'][/email], [email='ccEMail@mail.de'][/email] ,"", "Hier steht der Betreff","Anhangxyz.txt",$olFormatHTML,"","")

    [/autoit]

    Es gab dazu einige sehr gute .au3 Hilfedateien mit Beispielen, die Du mit Sicherheit vorliegen hast. Die einzelnen Optionen sind selbsterklärend.
    In Deinem Verzeichnis müssen auch die OutlookWarning...Dateien vorhanden sein.

    Das Outlook UDF funktioniert perfekt. Mit dem neuen OutlookEX UDF stehen noch mehr Möglichkeiten zur Verfügung.

  • Ihr habt recht. Danke für eure hilfe werde sofort OutlookEX-UDF downloaden und Probieren. :thumbup: