Integration with Outlook
Posted: Sun May 30, 2010 5:09 pm
Hi! I've created a working rule for MS Outlook that captures specified emails, dumps some of their content into a text file, then triggers a standalone Rev stack named "sReader" to parse them. My question is, is there a way for a standalone stack to recognize that an instance of it is already open so I don't get multiple copies running? I was thinking about looking at all running processes in preOpenStack but that seems a heavy handed way to do it. The current setup gets 50 or more copies of the app running, not a good thing -)
In the VBA rule below the operative lines are:
Here's the VBA rule:
In the VBA rule below the operative lines are:
Code: Select all
Set objShell = CreateObject("WScript.shell")
objShell.Run ("C:\AWork\sReader.exe")
Here's the VBA rule:
Code: Select all
Sub TriggerReader(MyMail As MailItem)
Dim strID As String
Dim objMail As Outlook.MailItem
Dim newFileName As String
Dim objFSO
Dim outFile
Dim inboxPath As String
Dim objShell
On Error Resume Next
inboxPath = "C:\AWork\InBox\"
strID = MyMail.EntryID
Set objMail = Application.Session.GetItemFromID(strID)
Set objFSO = CreateObject("Scripting.FileSystemObject")
newFileName = inboxPath & "z" & objMail.EntryID & ".txt"
Set outFile = objFSO.CreateTextFile(newFileName)
outFile.writeLine "rSubj: " & objMail.Subject
outFile.writeLine "rTo: " & objMail.To
outFile.writeLine "rCC: " & objMail.CC
outFile.writeLine "rName: " & objMail.SenderName
outFile.writeLine "rAddr: " & objMail.SenderEmailAddress
outFile.writeLine "rSent: " & objMail.SentOn
outFile.writeLine "rRecip: " & objMail.Recipients
outFile.writeLine "rCreation: " & objMail.CreationTime
outFile.writeLine "rBody: " & objMail.Body
outFile.writeLine "---------------------"
outFile.writeLine "rHTML: " & objMail.HTMLBody
outFile.writeLine "---------------------"
outFile.Close
Set objShell = CreateObject("WScript.shell")
objShell.Run ("C:\AWork\sReader.exe")
Set objMail = Nothing
Set objFSO = Nothing
Set outFile = Nothing
Set objShell = Nothing
End Sub