Simpel

[halfway solved] Lotus Notes: show signature rich text

2 posts in this topic

#1 ·  Posted (edited)

Hi.

In an GUI I want user show his Lotus Notes signature:

#include <GUIConstantsEx.au3>
#include <GuiRichEdit.au3>
#include <WindowsConstants.au3>
#include <array.au3>
Example()

Func Example()
    Local $hGui, $hRichEdit, $iMsg
    $hGui = GUICreate("Example", 800, 800, -1, -1)
    $hRichEdit = _GUICtrlRichEdit_Create($hGui, "", 10, 10, 780, 780, _
            BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
    GUICtrlSetFont($hRichEdit, 12)
    _GUICtrlRichEdit_AppendText($hRichEdit, @CRLF & _Signatur())
    GUISetState(@SW_SHOW)

    While True
        $iMsg = GUIGetMsg()
        Select
            Case $iMsg = $GUI_EVENT_CLOSE
                _GUICtrlRichEdit_Destroy($hRichEdit) ; needed unless script crashes
                Exit
        EndSelect
    WEnd
EndFunc   ;==>Example

Func _Signatur()
    Local $oMailSession = ObjCreate("Notes.NotesSession")
    Local $sMailUser = $oMailSession.UserName
    Local $sMailDbName = StringLeft($sMailUser, 1) & StringRight($sMailUser, (StringLen($sMailUser) - StringInstr(1, $sMailUser, " "))) & ".nsf" ; Name der Mail-Datenbank
    Local $Maildb = $oMailSession.GETDATABASE("", $sMailDbName)
    If $Maildb.IsOpen <> 1 Then
        $Maildb.OPENMAIL()
    EndIf
    Local $ProfileDoc = $Maildb.GetProfileDocument("CalendarProfile")
    Local $enabled = $ProfileDoc.GetFirstItem("EnableSignature") ; fragt das Profile ab ob Signaturen überhaupt aktiviert sind
    Local $senabled = $enabled.Abstract(80, False, False)
    If $senabled = 1 Then
        Local $option = $ProfileDoc.GetFirstItem("SignatureOption") ; Fragt das Profile ab welche Signaturart gesetzt ist
        Local $soption = $option.Abstract(80, False, False)
    EndIf
    If $senabled = "1" Then
        Local $aSignature = $Maildb.GetProfileDocument("CalendarProfile").GetItemValue("Signature") ; Signatur des Mail-Accounts auslesen
        Switch $soption
            Case "1" ; Nurtext-Signatur
                ConsoleWrite("Nur-Text-Signatur" & @CRLF)
                $sSignatur = $aSignature[0]
            Case "2" ; Signatur aus HTML / Image
                ConsoleWrite("Signatur aus HTML / Image bei Backenddokumenten nur über API möglich." & @CRLF)
            Case "3" ; Richtext-Signatur --- ### This is the problem ### --- ### --- ###
                ConsoleWrite("RichText-Signatur" & @CRLF)
                $sSignatur = $ProfileDoc.GetfirstItem("Signature_Rich").Abstract(800, False, False)
;~              $sSignatur = $ProfileDoc.GetfirstItem("Signature_Rich")
                ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $sSignatur = ' & $sSignatur & @CRLF & '>Error code: ' & @error & '    Extended code: ' & @extended & ' (0x' & Hex(@extended) & ')' & @CRLF) ;### Debug Console
        EndSwitch
    EndIf
    $Maildb = "NULL"
    $oMailSession = "NULL"
    Return $sSignatur
EndFunc

If the user has pure text signature it works perfect. If he uses rich text for signature I'm only able to get the signature as a string w/o all the @CRLF. They are spaces instead. If I don't append .Abstract(800, False, False) then I won't get anything.

Best choice is I can show the signature in rich text. If not possible then show text but with new lines. Any suggestions?

Regards,  Conrad

Edited by Simpel

SciTE = 3.6.2.0/full   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win7Pro SP1   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE   H:\...\AutoIt3   H:\...\AutoIt3\Include   H: = Network Drive

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

Share this post


Link to post
Share on other sites



#2 ·  Posted

Suddenly I had a new idea:

$sSignatur = $ProfileDoc.GetfirstItem("Signature_Rich").Text

With this I am able to show rich text signature as pure text. It's not the best I wanted but works. If somebody has an idea for showing it in rich text I would be happy.

Conrad


SciTE = 3.6.2.0/full   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win7Pro SP1   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE   H:\...\AutoIt3   H:\...\AutoIt3\Include   H: = Network Drive

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

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