Machsupport Forum
Mach Discussion => General Mach Discussion => Topic started by: mythal on June 20, 2011, 12:45:45 PM
-
Hi
I'm trying to semi auto my Mach3 by adding a file-loading Macro(M555) at initialization string.
and wish to have Mach3 to run a Macro (M159) to call a App.exe at the end of my Gcode
However, when I press the RESET button to initial the Mach3, Mach3 run M555 correctly , but launch M159 at same time (which I wish to be run at the very end of the process)
Is there anyone can give me some suggestion to get this right?
Thanks!
here are the codes I use:
M555:
LoadFile ("C:\Sample.NC")
M159:(referenced from http://www.machsupport.com/forum/index.php/topic,13960.0.html)
Option Explicit
Dim CmdString As String
Const Filename = "C:\Run.exe"
Const AppFQFN = "C:\windows\system32\CMD.exe"
CmdString = """" & APPFQFN & """" & " " & """" & FileName & """"
Shell(CmdString)
my Gcode-Sample.NC:
G00 G49 G40.1 G17 G80 G50 G90
G21
M6 T1
M5 M9
M159
M30
-
If I understand correctly you dont want Mach to fire off the Mcode will the file is being loaded?
In Config/General Logic Configuration/Ignore M Calls While Loading check
Or in your code you can put:
If isloading() Then
MsgBox "is loading"
Else
MsgBox "is Not loading"
End IF
-
Super!
I tick the "Ignore M Calls While Loading" and it works !
Thank you zealous.