This is one I use in the Start button on my big lathe. It is looking for the inputs from spindle enable/disable switch and also the headstock low/high gear ranges.
If GetInput(23) And (GetInput(10) Or GetInput(11)) Then 'look at modbus inputs
DoOemButton(1000) ' if inputs are seen Start
Else
DoOemButton(1003) ' if inputs not seen Stop
MsgBox("Engage Headstock or Enable Spindle") ' pop up message box telling me whats wrong
End
End If
The Inputs I am using are Modbus inputs so if you were to be using the normal inputs in Mach you would use IsActive(Input1) etc instead of GetInput()
As said the script above is in the actual start button, to do that you open the screenset in one of the screen designers and change the start button to a VB button. Once back in Mach you can go to the Operator menu then Edit Button Scripts and you will then see the Start flashing, click it and the editor will open which will allow you to type in your VB script.
Hood