• Creator
    Topic
  • #4517
    simonh1170
    Participant

    Hi

    I’m wanting to create a new applet which I can use as a default ‘new mail’ button. Basicallay I need to merge these two applets so that the company logo and footer automatically populate the email without having to click the signature button.

    This is the new mail applet code

    Sub Main(Client, GWEvent)

    Dim Msg

    ‘ Create a new visible email message

    GroupWise.NewMail

    ‘ Attempt to access the composing item

    ‘ If available, set its subject and body text

    Set Msg = GroupWise.ComposingItem

    If Msg is Nothing Then

    MsgBox(“No composing item available”)

    Else

    Msg.Subject = “Re:”

    Msg.BodyText = “”

    Set Msg = Nothing

    End If

    End Sub

    And this is the signature code

    Dim Dlg
    HRT = Chr(13) & Chr(10)
    Const CAPTION = “Formativ Business Solutions”
    ‘ Default extension
    Const mHTML = 2
    Const sSigExt = “.txt”
    ‘ Path to the signature file folder
    sSigDir = Utilities.GetDataDirectory + “Signatures”



    ‘ Main line processing



    Sub Main(Client, GWEvent)

    Dim Msg

    If ValidMsg(Msg) Then
    AddSignature(sSigDir + LCASE(GroupWise.EnvUserID))
    Else
    Call MsgBox(“No GroupWise items are available.”, 64, CAPTION)
    End If

    End Sub



    ‘ Add signature to the message



    Sub AddSignature(sBaseName)

    Dim FSO
    Dim sExt

    Set FSO = CreateObject(“Scripting.FileSystemObject”)

    sFileName = “”
    bText = FALSE
    bHTML1 = FALSE
    bHTML2 = FALSE

    ‘First check for file existence
    if FSO.FileExists(sBaseName + sSigExt) then
    bText = TRUE
    end if
    if FSO.FileExists(sBaseName + “.htm”) then
    bHTML1 = TRUE
    end if
    if FSO.FileExists(sBaseName + “.html”) then
    bHTML2 = TRUE
    end if

    if (not bText) and (not bHTML1) and (not bHTML2) then
    Call MsgBox(“Unable to find the signature file [” & sBaseName & “.txt, .htm or .html].” & HRT &_
    “Please contact your system administrator for assistance.”, 64, CAPTION)
    exit sub
    end if

    ‘ Check which editing mode is being used, HTML or Plain Text
    If GroupWise.EnvEditorStyle = mHTML then
    if bHTML1 then
    sFileName = sBaseName + “.htm”
    end if
    if bHTML2 then
    sFileName = sBaseName + “.html”
    end if
    if (not bHTML1) and (not bHTML2) and bText then
    sFileName = sBaseName + “.txt”
    end if
    else
    if bText then
    sFileName = sBaseName + “.txt”
    else
    Call MsgBox(“Unable to find the signature file. Please contact your system administrator for assistance.”, 64, CAPTION)
    exit sub
    end if
    end if

    ‘Set the position where you want to place the signature.
    ‘ To place the signature at the:
    ‘ top of the message – uncomment Call GroupWise.PosTextTop
    ‘ end of the message – uncomment Call GroupWise.PosToEndOfText
    ‘Call GroupWise.PosTextTop
    ‘Call GroupWise.PosToEndOfText
    Call GroupWise.Retrieve(sFileName)
    ‘uncomment next GroupWise PosTextTop line if you want the cursor to
    ‘reposition to the top of the message after the signature is added.
    ‘Call GroupWise.PosTextTop

    Set FSO = Nothing

    End Sub



    ‘ Do we have a composing item available?



    Function ValidMsg(ByRef Msg)

    On Error Resume Next
    Set Msg = GroupWise.ComposingItem

    If Msg is Nothing then
    ValidMsg = FALSE
    Else
    ValidMsg = TRUE
    End If

    End Function

    I can get them both working idependently, but not in the same applet.

  • You must be logged in to reply to this topic.