Hello Guest it is August 25, 2019, 11:38:41 PM

Author Topic: initialization string problem - Run a script by Macro  (Read 6652 times)

0 Members and 1 Guest are viewing this topic.

initialization string problem - Run a script by Macro
« 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




Offline zealous

*
  •  492 492
  • HI!
    • View Profile
    • Artsoft Solutions
Re: initialization string problem - Run a script by Macro
« Reply #1 on: June 20, 2011, 01:29:35 PM »
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:

Code: [Select]
If isloading() Then
MsgBox "is loading"
Else
MsgBox "is Not loading"
End IF
Re: initialization string problem - Run a script by Macro
« Reply #2 on: June 20, 2011, 08:46:44 PM »
Super!

I tick the "Ignore M Calls While Loading" and it works !

Thank you zealous.