Hello Guest it is March 28, 2024, 06:37:22 PM

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

0 Members and 1 Guest are viewing this topic.

Offline Davek0974

*
  •  2,606 2,606
    • View Profile
Run a macro from a button press??
« on: September 11, 2016, 10:08:32 AM »
Is there a correct or preferred way to execute a macro from a button press via an input on the CSMIO controller?

I have input 9 wired to a panel button that i want to execute auto-z reference for my mini-mill, the button needs to call M881.m1s which holds all the custom code (2010 screen-set) to do the height measuring etc.

Can't seem to find a method here?
Re: Run a macro from a button press??
« Reply #1 on: September 11, 2016, 01:23:06 PM »
I asked the same question last month and used this thread as a way forward, it pertains to useing a xbox 360 controller, I hope it helps

http://www.machsupport.com/forum/index.php/topic,32445.0.html

regards

Offline Davek0974

*
  •  2,606 2,606
    • View Profile
Re: Run a macro from a button press??
« Reply #2 on: September 11, 2016, 01:29:48 PM »
Ok, that might do it, use a screen editor to assign a hotkey then configure an OEM trigger to use that hotkey?

Will try it tomorrow night.

Thanks

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Run a macro from a button press??
« Reply #3 on: September 11, 2016, 01:42:00 PM »
Have the code in your macropump and have it activated when it sees the input from the button.


Hood

Offline Davek0974

*
  •  2,606 2,606
    • View Profile
Re: Run a macro from a button press??
« Reply #4 on: September 11, 2016, 02:15:12 PM »
All the code - it's a pretty lengthy macro routine on this screen-set??

Or just use a "RunScript.." command, if that even works, just guessing here ;)

Offline Davek0974

*
  •  2,606 2,606
    • View Profile
Re: Run a macro from a button press??
« Reply #5 on: September 25, 2016, 10:55:34 AM »
Any reason this is not working???

I have a button input - input 9

In screen4 I edited a screen button and gave it a short-cut of shift-1 which it showed as code 1073

In ports and pins I have assigned OEMTrigger9 to pin 9 port 10 (csmio default port)

In System system hotkeys I have assigned OEMTrigger 9 the value of 1073

Now,

on the keyboard if i press shift-1 the screen button is activated as expected but if i press the physical button nothing happens.

Have i missed a step?

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: Run a macro from a button press??
« Reply #6 on: September 25, 2016, 11:29:51 AM »
Hi Dave

You're confusing OEM codes with hot key codes.

Offline Davek0974

*
  •  2,606 2,606
    • View Profile
Re: Run a macro from a button press??
« Reply #7 on: September 25, 2016, 11:33:20 AM »
Ah bum, so is this route a dead-end?

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: Run a macro from a button press??
« Reply #8 on: September 25, 2016, 11:44:27 AM »
yep - 'fraid so.

AFAIK there's no "elegant" way to do what you're after.

But you have clues earlier. i.e. the macropump and runscript. (note: runscript isn't present in earlier versions of Mach3 - I can't use it for example because I use 3.42.20)

Here's one way:

put your macro code in a file.

Monitor your input in the macropump and use runscript to run your macro (as opposed to putting the code itself in the macropump). If you do this be aware of the difference between an input BEING active and an input GOING active. Otherwise you'll end up in a world of pain.

Then also put a runscript call in your button.

Then at least you have just one copy of code run from two places as opposed to two copies - one in the pump and the other in the button.

FWIW - you *should* have been able to use a trigger macro but they're flawed. I raised it with Brian a thousand years ago but he couldn't see the problem so wouldn't fix it.

« Last Edit: September 25, 2016, 11:47:17 AM by stirling »

Offline Davek0974

*
  •  2,606 2,606
    • View Profile
Re: Run a macro from a button press??
« Reply #9 on: September 25, 2016, 12:00:19 PM »
Thanks

I did try the triggermacro thing but all it ended in doing was completely hanging Mach3, had to fall back on a backup - didn't try again.

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'll play with the macropump - seems the only way.