Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: ribica1993 on December 10, 2017, 04:48:04 PM

Title: Mach4 script
Post by: ribica1993 on December 10, 2017, 04:48:04 PM
Hello !

I am new there. Need your help.

So. If i call code M311 for example, this code activate OUTPUT5 and wait time in DRO. When this time go out deactivate OUTPUT5.

Can anyone do script for me. please
Title: Re: Mach4 script
Post by: mkullman on December 10, 2017, 09:31:25 PM
not sure exactly what you are looking for, but this will get you started.
Code: [Select]
    function m311()
    inst=mc.mcGetInstance()

  local hReg = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT5)

  local rc = mc.mcSignalSetState(hReg, true)

end

if (mc.mcInEditor() == 1) then
    m311()
end
I started you off by putting the above code in a text file and changed the extension to .mcs (attached) and which you can put it in your profile's "macro" folder.
it will turn on output5 when you call M311

You can than refer to the "Scripting Manual" in your Mach4 Docs folder to edit and refine the script to do what you want it to.

enjoy!