Support

uScope Navigator (Preferences) How to Send Email When a Scan Completes
uScope Navigator (Preferences)

Information in this article applies to:

  • uScope Navigator V4.0 and Later

Article ID: NPF1164 — Created: 11 Mar 2018 — Reviewed: 30 Mar 2018

Question

Is it possible to send an email when a scan completes?

Answer

Yes. Several things are required to do this:

  1. You will need a script that can send an email message.
  2. You must, of course, modify the script for your email server, sender, and recipient.
  3. You must add the script to the uScope Navigator workflow.

Creating a Script to Send Email

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:

  • Your SMTP server and port.
  • The account user ID and password (if required).
  • The From and To email addresses as well as the Email Subject.

The script is called from within the uScope Navigator application.

  • SendEmail.wsf

'==================================================================================================
'==================================================================================================
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") = 2
oCfg.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpServer
oCfg.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = smtpPort

' SMTP authentication
If smtpAccount <> "" Then
  oCfg.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
  oCfg.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = smtpAccount 
  oCfg.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = smtpPassword 
End If
 
oMail.Configuration.Fields.Update

oMail.From = emailFrom
oMail.To   = emailTo
oMail.Subject  = emailSubject
oMail.Textbody = "Your scan (" & sJobName & ") has completed." & vbCrLf & vbCrLf
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).

  • /JobName:%JobName%
    Specifies the name of the scan job. %JobName% is a macro that is replaced by uScope Navigator with the name of the current job.

Adding the Script to the uScope Navigator Workflow

You can add a script that is run every time a scan is completed or whenever a Deep Zoom image is created.

To send an email when scanning is completed...

  1. Set Post Scan Action Select the Application tab from the Program Options dialog. Here, you can specify commands or scripts that run automatically before and after scanning a region of interest.
  2. Under Post Scan Action, select Command and enter C:\Windows\System32\wscript.exe. This is a Windows command that is required to run Windows Script Host files.
  3. For Parameters, enter "C:\Scripts\sendemail.wsf" "/jobname:%JobName%" as shown.

Now, when you complete scanning a region of interest, the script is automatically run and the email message is sent.

To send an email after creating a deep zoom image...

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.

  1. Select the Deep Zoom Options tab from the Program Options dialog. Here, you can specify commands or scripts that run automatically before and after creating a Deep Zoom image.
  2. Under Post Deep Zoom Action, select Command and enter C:\Windows\System32\wscript.exe. This is a Windows command that is required to run Windows Script Host files.
  3. For Parameters, enter "C:\Scripts\sendemail.wsf" "/jobname:%JobName%" as shown.

Now, after a deep zoom image is created, the script is automatically run and the email message is sent.

Related Articles

Rate This Article
Contact Microscopes International or speak with your local distributor.
Copyright © 2018 Microscopes International, LLC. All rights reserved.