Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: Tony Bullard on January 27, 2009, 11:42:02 AM

Title: Attaching a macro to OEM input trigger OEM code 301?
Post by: Tony Bullard on January 27, 2009, 11:42:02 AM
I’d like to have a button (switch) attached to an I-PA C keyboard emulator initiate an OEM trigger to call a macro. How do I use the OEM code 301 to call the macro? Any help or an example would be greatly appreciated. Thanks, Tony
Title: Re: Attaching a macro to OEM input trigger OEM code 301?
Post by: Chaoticone on January 27, 2009, 04:49:36 PM
In config, ports and pins, inputs you can set up an oem trigger and assign a hot key. Set the input to the Ipac to the same key stroke in Keygrabber. Go to config, system hot keys and set the oem trigger that corrosponds to the one you set up in inputs and assign it the OEM code.

You could also add a VB buton to your screen set with the script in it and assign it a hot key in screen 4.

Brett
Title: Re: Attaching a macro to OEM input trigger OEM code 301?
Post by: Tony Bullard on January 28, 2009, 07:48:24 AM
Thanks Bertt,
I’ve done exactly what you suggested but here is where I’m having the trouble. Your quote- “assign it the OEM code.” I’ve assigned OEM code 301 to trigger # 1. I’ve writhen a simple VB script for test. It moves the Z down .2 units and then back up .2 units. It is labeled M35.m1s. How do I link M35.m1s to OEM code 301?

Tony
 
Title: Re: Attaching a macro to OEM input trigger OEM code 301?
Post by: Hood on January 28, 2009, 08:04:47 AM
Not sure but could it be you need to name it M301.m1s ?

Hood
Title: Re: Attaching a macro to OEM input trigger OEM code 301?
Post by: Tony Bullard on January 28, 2009, 08:22:14 AM
I've tried that but the code has to be an integer. I'm finding other refferances to "SetTriggerMacro". I'll keep looking. Thanks hood.
Title: Re: Attaching a macro to OEM input trigger OEM code 301?
Post by: Hood on January 28, 2009, 08:24:40 AM
where did you find the info about OEM301?
Hood
Title: Re: Attaching a macro to OEM input trigger OEM code 301?
Post by: Tony Bullard on January 28, 2009, 08:35:02 AM
From OEM Button Codes in MachCustomizeWiki--- "Code for OEMTriggers runs the macro in SetTriggerMacro 301"

And from "Communications Routes" in MachCustomizeWiki

VB Script programs
A VB Script program can be used in three ways:

By being "attached" to a screen button and so be run when the button is clicked or its hotkey is pressed
By being put in a macro and called from within a part program, the MDI line of the G-code attached to a button. The last of these methods being suitable if the program is too big to attach directly to the button or is required to be used as a macro from a part program as well as a button.
By being a macro attached to an OEM input trigger by OEM code 301.

Tony
 
Title: Re: Attaching a macro to OEM input trigger OEM code 301?
Post by: Tony Bullard on January 28, 2009, 10:20:10 AM

Thank all of you for your help. I’ve found a way that will work for the time being. With the help from “Mach specific Subroutines / Functions grouped by purpose” from MachCustomizeWiki I used the following:

“Sub SetTriggerMacro (MacroNo as Integer)
Defines the number of a macro to be executed when an OEMTrigger is set (slightly unexpectedly on the Config>Set System Hotkeys dialog) to generate OEM code 301. This provides script execution without the requirement for a screen button as intermediary.
For example if SetTriggerMacro 456 has been executed then a signal on any OEMTrigger configured to 301 will run the code in the file M456.M1S when activated.”
I wrote a script with VB Script Editor and saved it as Msetup.m1s. When I first start Mach3 I run the script from VB Script Editor. The script reads “ SetTriggerMacro 35”. M35 is my test routine. As mentioned before I’ve set up an OMETrigger #1 with code 301. When I hit the switch associated with OEM Triggger # 1 the M35 code executes. It all needs some tweaking but I’m  on the right tract.

One problem I see with this is that I can only run one script with code 301. If I wanted to run another from a different Trigger I’d have to run a different “SetTriggerMacro” before hitting the new switch because they are all called from code 301. I wonder if there is such a thing as 301-2, 301-3 etc. Or maybe there is “SetTriggerMacro#1,M---”,  “SetTriggerMacro#2,M---”,  Something to think about.

Tony



Title: Re: Attaching a macro to OEM input trigger OEM code 301?
Post by: Hood on January 28, 2009, 01:55:55 PM
Thanks for the info. I talked to Brian earlier  and he said he wants to do things differently in the future so will be looking at this, when that will be I have no idea as there are many other things to get done first.
Hood
Title: Re: Attaching a macro to OEM input trigger OEM code 301?
Post by: Tony Bullard on January 28, 2009, 02:16:22 PM
Thanks again Hood, I wonder if there is a way I could be notified of any changes.
Tony
Title: Re: Attaching a macro to OEM input trigger OEM code 301?
Post by: Hood on January 28, 2009, 02:20:47 PM
I would imagine it will be in the ChangeLog when it gets done so just keep an eye on that.
Hood
Title: Re: Attaching a macro to OEM input trigger OEM code 301?
Post by: Tony Bullard on January 28, 2009, 02:51:15 PM
I guess I'm running out of gas. Where can I find the changeLog file? Is there a way to check for updates to the Mach3 program? I can't seem to find either on March3 Home site.
Title: Re: Attaching a macro to OEM input trigger OEM code 301?
Post by: Hood on January 28, 2009, 02:54:53 PM
Go to the top of this page  and click on the downloads tab then Mach and LazyCAM.
Hood
Title: Re: Attaching a macro to OEM input trigger OEM code 301?
Post by: Tony Bullard on January 28, 2009, 02:57:46 PM
Thanks,
I'll get the hang of this someday
Title: Re: Attaching a macro to OEM input trigger OEM code 301?
Post by: Hood on January 28, 2009, 03:00:22 PM
Think you seem to have a good handle on it already ;)Hood
Title: Re: Attaching a macro to OEM input trigger OEM code 301?
Post by: Hood on February 21, 2009, 05:40:35 AM
Tony,
 Think Scotts plugin will be very useful to you, you can call up to 15 macros from User LEDs, see here
http://www.machsupport.com/forum/index.php/topic,10399.msg66043.html#msg66043

Hood
Title: Re: Attaching a macro to OEM input trigger OEM code 301?
Post by: Tony Bullard on February 21, 2009, 08:17:03 AM
Thanks Hood,

I'll buy it and give it a try.
Tony
Title: Re: Attaching a macro to OEM input trigger OEM code 301?
Post by: darlly01 on May 09, 2013, 09:43:30 PM
Hi tony bullard,

I had the same problem you have and I solve it with MadMach plugin, I use it to trigger more than 10 macros, and it is working good for me. You can tray it .

Good Luck!
Title: Re: Attaching a macro to OEM input trigger OEM code 301?
Post by: jrslick22 on August 05, 2018, 07:03:01 PM
Hey guys, im sorta after the same thing here, i have a pnumatic clamp that i lock with m20 and unlock with m21, i need to activated this with a hardware momentary button that does the opposite to the current state, so if m20 is active pressing the button will toggle it to m21 and visa versa, any help would be appreciated.
Title: Re: Attaching a macro to OEM input trigger OEM code 301?
Post by: Tony Bullard on August 06, 2018, 07:49:17 AM
Hi tony bullard,

I had the same problem you have and I solve it with MadMach plugin, I use it to trigger more than 10 macros, and it is working good for me. You can tray it .

Good Luck!

Thanks darlly01. I've been using Mach Mad and it works very well. Thanks to Scott!