Jump to content

_OL_MailSignatureGet()


Syed23
 Share

Recommended Posts

Dear All,

I am getting Norm.dotm file to be opened request when i display array. is that something i can do stop prompting that message?

#AutoIt3Wrapper_AU3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#AutoIt3Wrapper_AU3Check_Stop_OnWarning=Y
#include <OutlookEX.au3>

Global $oOutlook = _OL_Open()
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error creating a connection to Outlook. @error = " & @error & ", @extended = " & @extended)

; *****************************************************************************
; Example 1
; List all Email signatures for the current mail account
; *****************************************************************************
Global $aSignatures = _OL_MailSignatureGet()
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_MailSignatureGet Example Script", "Error accessing mail signatures. @error = " & @error & ", @extended: " & @extended)
_ArrayDisplay($aSignatures)

_OL_Close($oOutlook)
Edited by Syed23

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Link to comment
Share on other sites

The function uses Microsoft Word under the covers to retrieve the data.

I have no idea why you get this error.

You could start Word yourself and pass the Word application object as parameter 2.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Does this work without killing Word?

#include <OutlookEX.au3>

Global $oOutlook = _OL_Open()
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error creating a connection to Outlook. @error = " & @error & ", @extended = " & @extended)

Global $aSignatures = _OL_MailSignatureGetEX()
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_MailSignatureGet Example Script", "Error accessing mail signatures. @error = " & @error & ", @extended: " & @extended)
_ArrayDisplay($aSignatures)

_OL_Close($oOutlook)

Func _OL_MailSignatureGetEX($sSignature = "", $oWord = 0)

    Local $bWordStart = False
    If $oWord = 0 Then
        $oWord = ObjCreate("Word.Application")
        $bWordStart = True
    EndIf
    If @error Or Not IsObj($oWord) Then Return SetError(1, @error, "")
    Local $oEmailOptions = $oWord.EmailOptions
    Local $oSignatureObject = $oEmailOptions.EmailSignature
    Local $oSignatureEntries = $oSignatureObject.EmailSignatureEntries
    Local $sNewMessageSig = $oSignatureObject.NewMessageSignature
    Local $sReplyMessageSig = $oSignatureObject.ReplyMessageSignature
    Local $aSignatures[$oSignatureEntries.Count + 1][3]
    Local $iIndex = 0
    For $oSignatureEntry In $oSignatureEntries
        If $sSignature = "" Or $sSignature == $oSignatureEntry.Name Then
            $iIndex = $iIndex + 1
            $aSignatures[$iIndex][0] = $oSignatureEntry.Name
            If $aSignatures[$iIndex][0] = $sNewMessageSig Then
                $aSignatures[$iIndex][1] = True
            Else
                $aSignatures[$iIndex][1] = False
            EndIf
            If $aSignatures[$iIndex][0] = $sReplyMessageSig Then
                $aSignatures[$iIndex][2] = True
            Else
                $aSignatures[$iIndex][2] = False
            EndIf
        EndIf
    Next
    ReDim $aSignatures[$iIndex + 1][3]
    $aSignatures[0][0] = $iIndex
    $aSignatures[0][1] = UBound($aSignatures, 2)
    If $bWordStart = True Then
        Local Const $wdDoNotSaveChanges = 0 ; Do not save pending changes
        $oWord.Quit($wdDoNotSaveChanges)
        $oWord = 0
    EndIf
    If $sSignature <> "" And $aSignatures[0][0] = 0 Then Return SetError(2, 0, "")
    Return $aSignatures

EndFunc   ;==>_OL_MailSignatureGetEX

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Great!

I will change the UDF accordingly.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...