Information in this article applies to:
Article ID: NPF1164 — Created: 11 Mar 2018 — Reviewed: 29 Aug 2019
Is it possible to send an email when a scan completes?
Yes. Several things are required to do this:
First, you need a script that sends an email message. The following Windows Script Host File does just that. You must modify the fields listed at the top of the file to specify:
The script is called from within the uScope Navigator application.
'================================================================================================== '================================================================================================== Option Explicit <job> <script language="VBScript"> Const smtpServer = "smtp.server.com" Const smtpPort = 25 ' 25, 465, 587 Const smtpAccount = "" Const smtpPassword = "" Const emailFrom = "From Name <from.me@email.address>" Const emailTo = "To Name <to.me@email.address>" Const emailSubject = "Your Scan has Completed" '================================================================================================== '================================================================================================== Function SendEmail (sJobName) Dim oMail Set oMail = CreateObject("CDO.Message") Set oCfg = oMail.Configuration.Fields ' Use an SMTP server oCfg.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort oCfg.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpServer oCfg.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = smtpPort oCfg.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True ' SMTP authentication If smtpAccount <> "" Then oCfg.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic oCfg.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = smtpAccount oCfg.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = smtpPassword Else oCfg.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoAnonymous End If oMail.Configuration.Fields.Update oMail.From = emailFrom oMail.To = emailTo oMail.Subject = emailSubject ' HTML vs TEXT Email If (True) Then oMail.HTMLbody = "<h1>Your scan (" & sJobName & ") has completed.</h1>" & vbCrLf & vbCrLf & sReport Else oMail.Textbody = "Your scan (" & sJobName & ") has completed." & vbCrLf & vbCrLf & sReport End If ' Add an email attachment ' oMail.AddAttachment "C:\Folder\Image.JPG" ' oMail.AddAttachment "C:\Folder\File.XML" ' oMail.AddAttachment "C:\Folder\Info.TXT" ' Send the Email Message oMail.Send Set oMail=Nothing End Function '================================================================================================== '================================================================================================== Function main () Set colNamedArguments = WScript.Arguments.Named SendEmail (colNamedArguments.Item("JobName")) End Function '================================================================================================== '================================================================================================== main() </script> </job> '================================================================================================== '==================================================================================================
You must copy the above script and paste it into a file on your PC. For illustration purposes, we place all scripts in the C:\Scripts folder. You can double-click on the script to run it. An email should be sent and received.
Note
It is beyond the scope of this knowledge base article to debug email and SMTP problems. For that, you need to contact your company's IT department for assistance.
The script is invoked as follows:
C:\Scripts\SendEmail.wsf "/JobName:%JobName%"
from within the uScope Navigator application at the end of each scan to send an email. Quotes are used to encapsulate arguments that may include spaces (like path names).
You can add a script that is run every time a scan is completed or whenever a Deep Zoom image is created.
Now, when you complete scanning a region of interest, the script is automatically run and the email message is sent.
As an alternative (or addition) to the above, you could automatically create a deep zoom image after each scan completes, then send the email after the deep zoom image is created.
Now, after a deep zoom image is created, the script is automatically run and the email message is sent.