Hello Guest it is March 29, 2024, 05:25:17 AM

Author Topic: Run a macro from a button press??  (Read 19973 times)

0 Members and 1 Guest are viewing this topic.

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: Run a macro from a button press??
« Reply #10 on: September 25, 2016, 12:03:13 PM »
The button has no code in it luckily - it just has the "run macro...." attribute set - i guess thats the same as an internal "runscript..."

I have no idea what that means but I doubt it's what you think it means.

Offline Davek0974

*
  •  2,606 2,606
    • View Profile
Re: Run a macro from a button press??
« Reply #11 on: September 25, 2016, 12:06:24 PM »
If you look at the  button in screen4 etc there are 3 action options - vb button editable in mach3, run macro, oem function

It just has the macro file set and nothing else

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: Run a macro from a button press??
« Reply #12 on: September 25, 2016, 01:23:30 PM »
Not in my version of Screen 4 - there are 4 options (which is correct because ALL editors should provide the 4 capabilities of the screen "driver" itself).

1) System Function
2) OEM Code Function
3) GCode Function
4) VB Script function edited in Mach3

If you set button option 4 and do what I said in #8 you're good to go.
« Last Edit: September 25, 2016, 01:25:32 PM by stirling »

Offline Davek0974

*
  •  2,606 2,606
    • View Profile
Re: Run a macro from a button press??
« Reply #13 on: September 25, 2016, 01:43:51 PM »
Oops, my bad, I was not at home earlier and tried to go by memory - D'oh!

Its the "Gcode Function" set to M889

I will change to VB script and add the unscript command.

Thanks

Offline ger21

*
  • *
  •  6,295 6,295
    • View Profile
    • The CNC Woodworker
Re: Run a macro from a button press??
« Reply #14 on: September 25, 2016, 05:30:09 PM »
It's possible to run 1 macro from a button press:
https://www.machsupport.com/forum/index.php/topic,10387.msg64292.html#msg64292

I wrote a step by step once on the Mechmate forum, but couldn't find it.
I've heard that the MachMad plugin will allow you to do more...
Gerry

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

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

Offline Davek0974

*
  •  2,606 2,606
    • View Profile
Re: Run a macro from a button press??
« Reply #15 on: September 26, 2016, 02:13:51 AM »
Thanks, i did try that before, all it seemed to do was to stop Mach loading - had to fall back to a backup xml, maybe only works on certain versions?

I'll try the macro pump version and see how that goes.

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: Run a macro from a button press??
« Reply #16 on: September 26, 2016, 05:30:48 AM »
OK - I might have mis-understood what you're wanting to do.

I read it as you wanted to run a macro BOTH from an external (real) button AND from a screen button.

I'm now thinking the use of a screen button was just your way of trying it and that all you really want is to run a macro from an external button. Is that correct?

If so then forget about the screen button completely.

Just use the macropump and if you don't want to put all the code IN the macropump then call it using runScript.

A word about trigger macros.

In this post http://www.machsupport.com/forum/index.php/topic,15120.msg101160.html#msg101160 I describe a way to fire multiple macros using OEMTriggers.

However, after I wrote that I discovered an annoying bug so I would use the macropump now instead.

The bug, if you're interested, is that whilst an OEM code trigger fires immediately, the trigger macro doesn't fire if there's anything in the gcode buffer. i.e. it will fire at some time later when the buffer becomes empty. If that's ok for your usage then fine but often you want the macro to run immediately regardless and that won't work. Like I said earlier I asked Brian to fix this ages ago when Mach3 was still supported but he chose not to for whatever reason.

Offline Davek0974

*
  •  2,606 2,606
    • View Profile
Re: Run a macro from a button press??
« Reply #17 on: September 26, 2016, 05:42:03 AM »
Yes thats what i need, i think the macropump idea will work perfectly, will try tonight.

Offline Davek0974

*
  •  2,606 2,606
    • View Profile
Re: Run a macro from a button press??
« Reply #18 on: September 26, 2016, 02:28:29 PM »

(note: runscript isn't present in earlier versions of Mach3 - I can't use it for example because I use 3.42.20)


Would it be in this version - "Mach3Version3.043.062.exe"  - is that version 043 or 062 ???
It does not run so i am guessing either i typed something wrong or this version does not support it ??

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: Run a macro from a button press??
« Reply #19 on: September 27, 2016, 04:37:04 AM »
See bottom of page 67 in Mach3_V3.x_Macro_Prog_Ref.pdf

Your version should be fine. Time to post your code.