Send Email About Which Label, How Many Times And Data Source Is Printed Follow

0
Avatar
Legacy Poster

Hi folks,

 

Is it possible through vb scripting when a label is printed that bartender sends out an email which label and data source is printed?

 

For example:

 

test.btw is printed

 

user receives a message:

 

test.btw

20 (which is the amount of prints)

hello world (which is the objects data source)

 

1 comments

0
Avatar
Ian Cummings
Moderator
Comment actions Permalink

Yes this is possible.  Use a document level VB script and choose the OnPrintJobEnd event.  A quick Google search will turn up plenty of VBS code examples on how to do this.  Here is one I found that should at least give you a fair idea on how to approach this:

 

Set emailObj      = CreateObject("CDO.Message")

emailObj.From     = "dc@gail.com"
emailObj.To       = "dc@gail.com"

emailObj.Subject  = "Test CDO"
emailObj.TextBody = "Test CDO"

Set emailConfig = emailObj.Configuration

emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing")    = 2  
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1  
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpusessl")      = true 
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername")    = "YourUserName"
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword")    = "Password1"

emailConfig.Fields.Update

emailObj.Send

If err.number = 0 then Msgbox "Done"

Please sign in to leave a comment.