Welcome, Guest. Please login or register.
Did you miss your activation email?
May 27, 2012, 09:58:03 AM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  Brains Development
| | |-+  Execute Button Script - how do you use it?
Pages: 1 2   Go Down
Print
Author Topic: Execute Button Script - how do you use it?  (Read 1696 times)
0 Members and 1 Guest are viewing this topic.
Rademacher
Active Member

Offline Offline

Posts: 25

Give it a try! How hard can it be?


View Profile
« on: November 24, 2010, 07:24:45 PM »

I have been attempting to write a brain that will trigger my auto Z script when a Pokey55 button is pushed.  Can't seem to find a way to make scripts run from brains. 

Does any one know how to implement the Execute Button Script?  I am thinking this maybe the solution to my problem.

thanks,
Wayne
Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
*
Offline Offline

Posts: 1,707


Briceville, TN, USA


View Profile WWW
« Reply #1 on: November 24, 2010, 07:58:31 PM »

Set Trigger Macro using “Push User Button” in Brians:

First, you dont put the code in a button, you put it in a macro file. For
example file: m600.m1s
SetMessage( "This is a macro call..")

Then , you have to set that macro to be the default macro call with a call to
SetTriggerMacro( 600 ) at some point in the program, an init string could do
that if the SetTriggerMacro call were in another macro file that is called on
startup.  Then the brain will execute m600 whenever that brain termination code is
called.
Logged

Commercial Mach3: Screens (regular and flash), Wizards, Plug-ins, Brains, PLCs, Macros, ATC's, machine build, retrofit and Prototyping
http://sites.google.com/site/volunteerfablab/
BR549
Active Member

Online Online

Posts: 2,555


View Profile
« Reply #2 on: November 24, 2010, 08:40:08 PM »

HIYA SCOT, I must have fallen off the pumpkin wagon and bumped my head. Could you explain that again???

(;-) TP
Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
*
Offline Offline

Posts: 1,707


Briceville, TN, USA


View Profile WWW
« Reply #3 on: November 25, 2010, 10:23:11 AM »

Sure....
Quote
Set Trigger Macro using “Push User Button” in Brians:
First, you dont put the code in a button, you put it in a macro file. For
example file: m600.m1s
SetMessage( "This is a macro call..")
Then , you have to set that macro to be the default macro call with a call to
SetTriggerMacro( 600 ) at some point in the program, an init string could do
that if the SetTriggerMacro call were in another macro file that is called on
startup.  Then the brain will execute m600 whenever that brain termination code is
called.

hehehehe.......... sorry couldn't resist...

Ok Make the "Macro" that you want to be triggered, for instance M600 as above this macro does what ever....
then if you want it to auto trigger you have to set it using the set macro call. this will be a SEPERATE macro call.

So under General cfg, in the Init Put your set trigger macro in the init line, call it M1000.m1s
in that macro put the set trigger macro call:

'M1000.m1s (in the init line)
SetTriggerMacro( 600 )

//////////////////////////

When Mach starts up, it runs the "Init" line, which in turn runs the SetTriggerMacro call and sets which macro number will trigger
i.e. M600.m1s

So, in Brains.....  you have your even that triggers your "Trigger Macro button" termination.......
for aurguments sake, lets say you use ULED 2000 to trigger that function.

so your rung would look like: NOTE!! You may, or may not have to make an invert OP call after the ULED
depending on where it is coming from.

ULED 2000->Invert OP->Trigger Macro Button

so when ULED 2000 turns on, it will run the function that runs the macro you have set in the trigger.....

see!!!! Simple as PIE!!!!!!!!  hehehhehehehe  (  NOT!!!!! )

scott
Logged

Commercial Mach3: Screens (regular and flash), Wizards, Plug-ins, Brains, PLCs, Macros, ATC's, machine build, retrofit and Prototyping
http://sites.google.com/site/volunteerfablab/
BR549
Active Member

Online Online

Posts: 2,555


View Profile
« Reply #4 on: November 25, 2010, 11:04:19 AM »

oK so it was NOT the bump on the head, maybe just blind but I don't see ANY button push in Brians that will terminate with a macro call. Can you give me the button number(;-)

Up to now I had to set a user led and then monitor the led from the macropump to make it work(Not a good way as it eats up resources)

(;-) TP
Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
*
Offline Offline

Posts: 1,707


Briceville, TN, USA


View Profile WWW
« Reply #5 on: November 25, 2010, 07:28:34 PM »

Huh? in brains 1034

s.
Logged

Commercial Mach3: Screens (regular and flash), Wizards, Plug-ins, Brains, PLCs, Macros, ATC's, machine build, retrofit and Prototyping
http://sites.google.com/site/volunteerfablab/
BR549
Active Member

Online Online

Posts: 2,555


View Profile
« Reply #6 on: November 25, 2010, 09:51:05 PM »

BOY someone needs to rename that button(;-)

So  does that mean you can only have one button and call one macro??

(;-) TP



Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
*
Offline Offline

Posts: 1,707


Briceville, TN, USA


View Profile WWW
« Reply #7 on: November 25, 2010, 10:09:24 PM »

yeap
Logged

Commercial Mach3: Screens (regular and flash), Wizards, Plug-ins, Brains, PLCs, Macros, ATC's, machine build, retrofit and Prototyping
http://sites.google.com/site/volunteerfablab/
Greolt
Global Moderator
*
Offline Offline

Posts: 872


View Profile
« Reply #8 on: November 26, 2010, 01:13:31 AM »

Thanks for that info Scott

I presume that button press is   "1034 - Execute Button Script"

Greg
Logged
Rademacher
Active Member

Offline Offline

Posts: 25

Give it a try! How hard can it be?


View Profile
« Reply #9 on: November 26, 2010, 09:16:16 AM »

Wow, so intuitive....can't believe I missed it;)

Seriously, really appreciate the help, I was really stuck.

Wayne
Logged
Pages: 1 2   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!