Hello Guest it is March 28, 2024, 03:44:46 PM

Author Topic: Attaching a macro to OEM input trigger OEM code 301?  (Read 23846 times)

0 Members and 1 Guest are viewing this topic.

Attaching a macro to OEM input trigger OEM code 301?
« 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

Offline Chaoticone

*
  • *
  •  5,624 5,624
  • Precision Chaos
    • View Profile
Re: Attaching a macro to OEM input trigger OEM code 301?
« Reply #1 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
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!
Re: Attaching a macro to OEM input trigger OEM code 301?
« Reply #2 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
 

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Attaching a macro to OEM input trigger OEM code 301?
« Reply #3 on: January 28, 2009, 08:04:47 AM »
Not sure but could it be you need to name it M301.m1s ?

Hood
Re: Attaching a macro to OEM input trigger OEM code 301?
« Reply #4 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.

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Attaching a macro to OEM input trigger OEM code 301?
« Reply #5 on: January 28, 2009, 08:24:40 AM »
where did you find the info about OEM301?
Hood
Re: Attaching a macro to OEM input trigger OEM code 301?
« Reply #6 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
 
Re: Attaching a macro to OEM input trigger OEM code 301?
« Reply #7 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



Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Attaching a macro to OEM input trigger OEM code 301?
« Reply #8 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
Re: Attaching a macro to OEM input trigger OEM code 301?
« Reply #9 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