Hello Guest it is November 22, 2019, 08:41:42 AM

Author Topic: Macro Question...  (Read 410 times)

0 Members and 1 Guest are viewing this topic.

Macro Question...
« on: March 30, 2019, 03:55:21 PM »
I found a VB script that will email me when executed. Most people set it up as an M30 macro. I am wanting to set it up as an M03 macro instead. My question is how do I get it to make the subject line of the email the next line in the G-Code? The reason for this is that Vectric Aspire will put the name of the step that it is running after every line with M03. I want an email to be sent to me every time a new step is ran with the subject line being the name of the step which requires reading that next line. Here is a sample of the applicable lines of G-Code as it is generated by aspire:

Code: [Select]
...
N350G00Z0.2000
N360S16000M03
(Step 1 - 8th - Inside Holes)
()
N390G00X4.0365Y4.7133Z0.2000
...
 

AND

Code: [Select]
...
N90880G00Z0.2000
N90890S16000M03
(Step 2 - 8th - Slow Profile Cut)
()
N90920G00X0.8160Y92.2155Z0.2000
...

Any help with reading the following line after the M03 so I can use it in my code like this would be appreciated:

Code: [Select]
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = <<LINE IN G-CODE FILE AFTER LINE CONTAINING THE M03 THAT TRIGGERED THE MACRO GOES HERE>>
objMessage.From = """Me"" <me@my.com>"
objMessage.To = "******************xx@*********xx.com"        *******************Insert Your Email address
objMessage.TextBody = "This is some sample message text.." & vbCRLF & "It was sent using SMTP authentication."

Thanks,
Matt

Offline ger21

*
  • *
  •  6,288 6,288
    • View Profile
    • The CNC Woodworker
Re: Macro Question...
« Reply #1 on: March 30, 2019, 08:34:03 PM »
I don't see any way to text comments from g-code into a macro.

And the example I saw used M3030.
I would not try to use M3 or M30, which are already used by other functions.

I would edit the Aspire post to use M3030 or any other unused number.
Gerry

2010 Screenset
http://www.thecncwoodworker.com/2010.html

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html
Re: Macro Question...
« Reply #2 on: March 30, 2019, 11:24:51 PM »
I got it figured out, thanks.

Matt

Offline ger21

*
  • *
  •  6,288 6,288
    • View Profile
    • The CNC Woodworker
Re: Macro Question...
« Reply #3 on: March 31, 2019, 08:03:57 AM »
If you figured out a way to do it, please share.
Gerry

2010 Screenset
http://www.thecncwoodworker.com/2010.html

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html

Offline BR549

*
  •  6,916 6,916
    • View Profile
Re: Macro Question...
« Reply #4 on: March 31, 2019, 03:36:57 PM »
One way would be to read teh line number that teh M3 is on. You know teh message will be on teh next line. Then parse teh Gcode file for teh next line number. Extract teh message from that line and send it to teh email handler.

M3  is on line 1002
Message in on line 1003
parse teh Gcode for string on line number 1003
Extract message phase from string
copy to email handler message input
Send email

Just a thought, (;-) TP