Hello Guest it is April 24, 2024, 06:56:30 PM

Author Topic: How to attach VB script to button  (Read 20195 times)

0 Members and 1 Guest are viewing this topic.

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: How to attach VB script to button
« Reply #20 on: October 14, 2007, 04:13:18 AM »
If GetOEMLed (846 = true) Then
 ActivateSignal(OUTPUT4)
Else
 DeActivateSignal(OUTPUT4)
End If

your code should be:

If GetOEMLed (846) Then

You probably meant

If GetOEMLed (846) = true Then

But there's no need to test against true - that's what 'if' does anyway.
« Last Edit: October 14, 2007, 04:16:32 AM by stirling »

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: How to attach VB script to button
« Reply #21 on: October 14, 2007, 08:52:32 AM »
Here use this brain, it does what you want.

scott
fun times
Re: How to attach VB script to button
« Reply #22 on: October 14, 2007, 11:22:35 AM »
Stirling,

Re wrote the macro as you suggested and when stepping through it using the VB script editor it functions perfectly. However after I save, close Mach3 and reopen it doesn't activate the Output 4 led on the diagnostics page. I have Output 4 enabled and set to Port 1, pin 17.
Any ideas?


Poppabear,

Your brain download indicates it is a zip file but when I download it shows as a .efw file which I have no idea what that is and if I try to open, nothing happens.
Downloaded and installed the latest lockdown version of Mach3 and tried writing a simple brain myself but when I try and enable it I get and ArtCode 9991 and it shuts Mach down.
The brains look to be much easier that the VB scripting and really cool.
Any suggestions here?

Thanks guys,

Claude

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: How to attach VB script to button
« Reply #23 on: October 14, 2007, 04:08:21 PM »
claude,

   I downloaded my own zip and it is correct the file in it called "enable.brn", is the brain file you need to put that file in your Brian folder under machs main directory. Then you need to goto operator and enable the brain called enable, then test it.

scott
fun times

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: How to attach VB script to button
« Reply #24 on: October 14, 2007, 04:25:33 PM »
here is a screen shot of your brian working in mach.  unzip the file and put the file "enable.brn" into the Brains folder under mach3, then open up mach3, goto operator and brain control, hit reload all brains, highlight ebable.bran , and hit the tick box enable. Then you can hit the View brain and see everything being green meaning it is working. You can also view the leds on the diag page.

scott
fun times

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: How to attach VB script to button
« Reply #25 on: October 15, 2007, 03:49:42 AM »
However after I save, close Mach3 and reopen it doesn't activate the Output 4 led on the diagnostics page.
just writing and saving a macro doesn't mean you've told Mach to run it.
But take a step back a moment - why are you trying to do this? if output pin enable1 has the state pattern you want then why not just use it? - why copy it to another output pin? - they're all just pins after all.
« Last Edit: October 15, 2007, 03:52:04 AM by stirling »
Re: How to attach VB script to button
« Reply #26 on: October 15, 2007, 08:27:06 AM »
Scott,

Tried downloading both the original file you posted and also the one with the screen shot post and in both cases Windows download popup showed the file as "enable.1.321CO2.efw". No mention of a .zip file.

After playing "Brains" all yesterday I finally came up with the same as you show in your screen shot and it is working fine. Think most of my difficulty stems from not fully understanding how the Brains function as well as the specific conventions used in Mach. Things are looking up now and the capabilities of Brains is very exciting.

Stirling,

That particular brain was just an example for my own learning experience. I did however  "and" it with another input to turn on a hydraulic pump and now have that Brain working as well. The logic tells the pump to turn on whenever Mach is online (reset green) "and" the offline button is not active. Still need to wire in the relay for the pump.

Thanks guys for all your help. I am sure I will be back with other questions.

Claude