Machsupport Forum

Mach Discussion => Mach Screens => Screen designer tips and tutorials => Topic started by: krsykes23 on December 13, 2015, 11:47:42 AM

Title: VB Script to buttons...
Post by: krsykes23 on December 13, 2015, 11:47:42 AM
Is there a way to 'Execute a Basic Script' to a button, but as a TOGGLE instead of two separate On/Off buttons and two
scripts?

I have a switch that I would like to run my dust extractor with....and I have set the Basic Script to ActivateSignal(OutPut2), which
works fine.  But I also need to turn it off...but preferably with the same button!

I guess I cannot do it with one button, but will need a second button to run DeActivateSignal(OutPut2)..?? 
Title: Re: VB Script to buttons...
Post by: ger21 on December 13, 2015, 06:09:42 PM
if not isactive then
activate
else
deactivate
end if
Title: Re: VB Script to buttons...
Post by: krsykes23 on December 18, 2015, 05:33:56 PM
Hi Gerry,

Thanks for the reply.  I've tried the script but get an error!  "Error on Line 1 - Argument not Optional"

I have checked that it's correctly spelled.  The 'Isactive' doesn't turn blue after I've typed it in the scripter...is that the problem?

This is what I have...

If Not Isactive Then
ActivateSignal(Output2)
Else
DeActivateSignal(Output2)
End If

Apologies for my ignorance...still learning this stuff!

Keith
Title: Re: VB Script to buttons...
Post by: Overloaded on December 18, 2015, 07:11:45 PM
If Not Isactive (Output2) Then
ActivateSignal(Output2)
Else
DeActivateSignal(Output2)
End If

I use similar but this way ...

If IsOutputActive(OUTPUT2) Then
DeActivateSignal(OUTPUT2)
else
ActivateSignal(OUTPUT2)
End if
Title: Re: VB Script to buttons...
Post by: krsykes23 on December 19, 2015, 12:18:38 PM
Hi Overloaded....worked a treat.  Thanks for the help!