hexagon logo

PC-DMIS Email Routine Complete Notification

PC-DMIS Email Routine Complete Notification

The other day the HxGN SFx was unable to send a notification to let me know that the routine was complete.
I decided to create a Email notification to let me know that the routine was finish measuring the part.
This script is set as default to send yourself an email. There are options to send the email using
cc and bcc. I am using TraceFields to control the input information.

PC-DMIS Routine Code:
PART NAME : Email Test
REV NUMBER : A
SER NUMBER :
STATS COUNT : 1

STARTUP =ALIGNMENT/START,RECALL:USE_PART_SETUP,LIST=YES
ALIGNMENT/END
MODE/MANUAL
FORMAT/TEXT,OPTIONS, ,HEADINGS,SYMBOLS, ;NOM,TOL,MEAS,DEV,OUTTOL, ,
LOADPROBE/3BY30_5W_M3_SH_2
TIP/TIP1, SHANKIJK=0, 0, 1, ANGLE=0

START_MENU_LT1=GROUP/SHOWALLPARAMS=YES
START_MENU_START_L1 =LABEL/

TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Part ID ; Part ID : PN00001
TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Rev Number ; Rev Number : R1
TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Lot Number ; Lot Number : LN0000A01
TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Serial Number ; Serial Number : SN1
TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Cavity ; Cavity : CN1
TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Machine Recall ID ; Machine Recall ID : 0000
TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=> Use Routine Complete Email Notification ; USE_EMAIL_NOTIF : Yes
TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=' View Routine Complete Email Notification Controls ; VIEW_EMAIL_NOTIF_CTRLS : Yes

START_MENU_END_L1 =LABEL/
ENDGROUP/ID=START_MENU_LT1

EMAIL_ROUTINE_COMPLETE_GRP1=GROUP/SHOWALLPARAMS=YES
EMAIL_ROUTINE_COMPLETE_START_L1 =LABEL/

IF_GOTO/GETTRACEVALUE("USE_EMAIL_NOTIF")=="No",GOTO = EMAIL_ROUTINE_COMPLETE_END_L1
IF/GETTRACEVALUE("VIEW_EMAIL_NOTIF_CTRLS")=="Yes"
TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Cc: (Carbon Copy) ; Cc :
TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Bcc: (Blind Carbon Copy) ; Bcc :
TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Subject: ; Subject : "Inspection complete for "+GETPROGRAMINFO("PARTNAME")+"_"+GETPROGRAMINFO("R EVISION")
TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Machine Info: ; Machine Info : "Machine Recall ID: "+GETTRACEVALUE("Machine Recall ID")
TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Part Info: ; Part Info : "Part Info: "+GETTRACEVALUE("Lot Number")+"_"+GETTRACEVALUE("Serial Number")+"_"+GETTRACEVALUE("Cavity")
TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Run Time: ; Run Time : "Run Time: "+ELAPSEDEXECUTIONTIME()
TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Total Number of Measured: ; Total Measured : "Total Measured: "+GETPROGRAMINFO("NUMMEAS")
TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Number Out of Tolerance: ; Total OutTol : "Total OutTol: "+GETPROGRAMINFO("NUMOOT")
END_IF/
EMAIL_ROUTINE_COMPLETE_CS1 =SCRIPT/FILENAME= C:\USERS\PUBLIC\DOCUMENTS\HEXAGON\ROUTINE BUILDER\ROUTINE BASIC SCRIPTS\EMAILSCRIPTTRACEFIELD1.BAS
FUNCTION/Main,SHOW=NO,ARG1=GETTRACEVALUE("Cc"),ARG2=GETTRAC EVALUE("Bcc"),ARG3=GETTRACEVALUE("Subject"),$
ARG4=GETTRACEVALUE("Machine Info"),ARG5=GETTRACEVALUE("Part Info"),$
ARG6=GETTRACEVALUE("Run Time"),ARG7=GETTRACEVALUE("Total Measured"),$
ARG8=GETTRACEVALUE("Total OutTol"),,
STARTSCRIPT/

EMAIL_ROUTINE_COMPLETE_END_L1 =LABEL/
ENDGROUP/ID=EMAIL_ROUTINE_COMPLETE_GRP1


Basic Script Code:

Sub main( pcOutLookCC, pcOutLookBCC, pcOutLookSub, pcOutLookMachInfo, pcPartInfo, pcRunTime, pcMeas, pcOutTol As String )
'
Dim outLookApp, outMail, pcApp, pcPart, outLookAllUsers, outLookExchUser, outLookEntry, myItem As Object
Dim outLookUser As String
'
Set outLookApp = CreateObject("Outlook.Application")
Set outLookAllUsers = outLookApp.Session.AddressLists.Item("All Users").AddressEntries
outLookUser = outLookApp.Session.CurrentUser.Name
Set outLookEntry = outLookAllUsers.Item(outLookUser)
Set outLookExchUser = outLookEntry.GetExchangeUser()
Set outMail = outLookApp.CreateItem(0)
'
outMail.To = outLookExchUser.PrimarySmtpAddress
outMail.cc = pcOutLookCC
outMail.bcc = pcOutLookBCC
outMail.Subject = pcOutLookSub
'
Dim msgHtmlBody1, msgHtmlBody2, msgHtmlBody3, msgHtmlBody4, msgHtmlBody5, msgHtmlBody6 As String
msgHtmlBody1 = "<BODY style=font-size:11pt;font-family:Calibri></BODY>" & pcOutLookMachInfo &" "& "</BODY>"
msgHtmlBody2 = "<BODY style=font-size:11pt;font-family:Calibri></BODY>" & pcPartInfo &" "& "</BODY>"
msgHtmlBody3 = "<BODY style=font-size:11pt;font-family:Calibri></BODY>" & pcRunTime &" "& "</BODY>"
msgHtmlBody4 = "<BODY style=font-size:11pt;font-family:Calibri></BODY>" & pcMeas &" "& "</BODY>"
msgHtmlBody5 = "<BODY style=font-size:11pt;font-family:Calibri></BODY>" & pcOutTol &" "& "</BODY>"
msgHtmlBody6 = "<BODY style=font-size:11pt;font-family:Calibri><br/>This is an automated message.</BODY>"
outMail.htmlBody = msgHtmlBody1 & msgHtmlBody2 & msgHtmlBody3 & msgHtmlBody4 & msgHtmlBody5 & msgHtmlBody6
sendMsg = outMail.Send
'
Set outLookApp = Nothing
Set outLookAllUsers = Nothing
Set outLookEntry = Nothing
Set outLookExchUser = Nothing
Set outMail= Nothing
'
End Sub
'
'Notes:
'
'Insert Basic Script command into Routine
'
'EMAIL_ROUTINE_COMPLET_CS1 =SCRIPT/FILENAME= C:\USERS\Public\DOCUMENTS\HEXAGON\ROUTINE BUILDER\ROUTINE BASIC SCRIPTS\EMAILSCRIPTTRACEFIELD1.BAS
' Function/Main,SHOW=NO,ARG1=GETTRACEVALUE("Cc"),ARG2=GETTRAC EVALUE("Bcc"),ARG3=GETTRACEVALUE("Subject"),$
' ARG4=GETTRACEVALUE("Machine Info"),ARG5=GETTRACEVALUE("Part Info"),$
' ARG6=GETTRACEVALUE("Run Time"),ARG7=GETTRACEVALUE("Total Measured"),$
' ARG8=GETTRACEVALUE("Total OutTol"),,
' STARTSCRIPT/
'
'Email Sample Output
'
'Inspection complete For Email Test_A
'
'Machine Recall ID: 0000
'Part Info: LN0000A01_SN1_CN1
'Run Time: 00:00:00
'Total Measured: 0
'Total OutTol: 0
'
'This is an automated message.



Parents


  • If I remember correctly, I might have a script using gmail instead of outlook. I'd have to check my personal computer and external drive later this weekend to see if I have that sitting around. I remember using it to text the notification to your phone through email as well


    Interesting...That'd be awesome!
Reply


  • If I remember correctly, I might have a script using gmail instead of outlook. I'd have to check my personal computer and external drive later this weekend to see if I have that sitting around. I remember using it to text the notification to your phone through email as well


    Interesting...That'd be awesome!
Children
No Data