I
International Connections
How can I (safely) trigger an Outlook automated message depending on
the existence of a file located on another machine that does not have
Outlook installed.
I have two PCs on our network, one is my workstation and the other is
build machine for our products.
We are not allowed to install Outlook on the build machine because of
security risk caused by malicious emails and so on...
After the automated build of our products is completed a log is
created on the fly by the build automation.
When this log appears (meaning the build is done) I would like to
launch the Outlook Message on my machine to send an email message. I
created the macro and it works fine (see code below).
I wonder how I can check for the existence of this file using Outlook?
Is there an Outlook function that would check for existence of the log
file for Outlook VBscript?
What could be a good Outlook Script solution?
wait / loop / use a timer?
Is there an Outlook function to wait for the creation of a file before
starting an event?
Can Outlook check every hour using a timer of some sort?
Any help, example, or advice is very welcomed.
Thank you in advance.
Regards
PS: Please don't send me direct emails, use the newsroom or go to
http://contactez.net/portfolio.html
http://gurleyalabama.contactez.net
=========
Excerpt of my Outlook VB Script code:
(C:\Documents and Settings\MyLogin\Application Data\Microsoft\Outlook)
=========
Dim ol As New Outlook.Application
Dim ns As Outlook.NameSpace
Dim newMail As Outlook.MailItem
Dim MSg As String
Dim FSO
Dim ws
Set ws = CreateObject("WScript.Network")
ws.MapNetworkDrive "X:", "\\BuilMachine\c$"
Set FSO = CreateObject("Scripting.FileSystemObject")
If FSO.fileExists("X:\Dominique\ProductBuild.log") Then
'Return a reference to the MAPI layer.
Set ns = ol.GetNamespace("MAPI")
'Create a new mail message item.
Set newMail = ol.CreateItem(olMailItem)
With newMail
'Add the subject of the mail message.
.Subject = "Automation Log and Report from Product Builder"
'Create text for body
MSg = "This is an automated message. " & Chr(10)
MSg = MSg & "Product Build Successful!" & Chr(10)
MSg = MSg & "Please read attached log file and correct any
error." & Chr(10) & Chr(10)
MSg = MSg & "For more information and assistance, read the
help file: " & Chr(10)
MSg = MSg & "http://TheServer/Directory1/CM/GM_CM_Help.chm" &
Chr(10)
.Body = MSg
'Add a recipient to test to make sure that the address is
valid using Resolve method
With .Recipients.Add("(e-mail address removed)")
.Type = olTo
If Not .Resolve Then
MsgBox "Unable to resolve address.", vbInformation
Exit Sub
End If
End With
'Attach a file as a link with an icon.
With .Attachments.Add _
("X:\Dominique\ProductBuild.log", olByReference)
.DisplayName = "Log Report from Product Builder"
End With
'Send the mail message.
.Send
End With
'Release memory.
Set ol = Nothing
Set ns = Nothing
Set newMail = Nothing
Else
MsgBox "Log not found so Wait Until Found.....?????"
End If
ws.RemoveNetworkDrive "X:", True
End
the existence of a file located on another machine that does not have
Outlook installed.
I have two PCs on our network, one is my workstation and the other is
build machine for our products.
We are not allowed to install Outlook on the build machine because of
security risk caused by malicious emails and so on...
After the automated build of our products is completed a log is
created on the fly by the build automation.
When this log appears (meaning the build is done) I would like to
launch the Outlook Message on my machine to send an email message. I
created the macro and it works fine (see code below).
I wonder how I can check for the existence of this file using Outlook?
Is there an Outlook function that would check for existence of the log
file for Outlook VBscript?
What could be a good Outlook Script solution?
wait / loop / use a timer?
Is there an Outlook function to wait for the creation of a file before
starting an event?
Can Outlook check every hour using a timer of some sort?
Any help, example, or advice is very welcomed.
Thank you in advance.
Regards
PS: Please don't send me direct emails, use the newsroom or go to
http://contactez.net/portfolio.html
http://gurleyalabama.contactez.net
=========
Excerpt of my Outlook VB Script code:
(C:\Documents and Settings\MyLogin\Application Data\Microsoft\Outlook)
=========
Dim ol As New Outlook.Application
Dim ns As Outlook.NameSpace
Dim newMail As Outlook.MailItem
Dim MSg As String
Dim FSO
Dim ws
Set ws = CreateObject("WScript.Network")
ws.MapNetworkDrive "X:", "\\BuilMachine\c$"
Set FSO = CreateObject("Scripting.FileSystemObject")
If FSO.fileExists("X:\Dominique\ProductBuild.log") Then
'Return a reference to the MAPI layer.
Set ns = ol.GetNamespace("MAPI")
'Create a new mail message item.
Set newMail = ol.CreateItem(olMailItem)
With newMail
'Add the subject of the mail message.
.Subject = "Automation Log and Report from Product Builder"
'Create text for body
MSg = "This is an automated message. " & Chr(10)
MSg = MSg & "Product Build Successful!" & Chr(10)
MSg = MSg & "Please read attached log file and correct any
error." & Chr(10) & Chr(10)
MSg = MSg & "For more information and assistance, read the
help file: " & Chr(10)
MSg = MSg & "http://TheServer/Directory1/CM/GM_CM_Help.chm" &
Chr(10)
.Body = MSg
'Add a recipient to test to make sure that the address is
valid using Resolve method
With .Recipients.Add("(e-mail address removed)")
.Type = olTo
If Not .Resolve Then
MsgBox "Unable to resolve address.", vbInformation
Exit Sub
End If
End With
'Attach a file as a link with an icon.
With .Attachments.Add _
("X:\Dominique\ProductBuild.log", olByReference)
.DisplayName = "Log Report from Product Builder"
End With
'Send the mail message.
.Send
End With
'Release memory.
Set ol = Nothing
Set ns = Nothing
Set newMail = Nothing
Else
MsgBox "Log not found so Wait Until Found.....?????"
End If
ws.RemoveNetworkDrive "X:", True
End