Sign in to follow this  
Followers 0
Syed23

_OL_MailSignatureGet()

6 posts in this topic

#1 ·  Posted (edited)

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]

Share this post


Link to post
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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

adding the below lines before _arraydisplay() helped me to resolve the issue.

ProcessClose("WINWORD.EXE")
Sleep(800)

Thank you water for your reply.


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

Share this post


Link to post
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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Yes Water! This works perfect and awesome!


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

Share this post


Link to post
Share on other sites

Great!

I will change the UDF accordingly.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
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
Sign in to follow this  
Followers 0