Hard - and Software


Mach3 Script Samples



Download Script Samples

These scripts are intended to show only the basics of script programming




When downloading, all samples are downloaded at once. Double .click MachScreenScriptSamplesVn.mm.exe to copy them to C:\Mach3.

All Samples have a:

 "Reset Button"

 "Reset LED"

"Clear" button to clear the error label

"Label" Error




Testing the scripts

Start Mach3

Load screenset

       Mach3 menu View -> Load Screens

      Select screenset form C:\Mach3


you have 2 ways for Inspecting the scripts

1  Start Machscreen

Load screenset

       MachScereen menu File -> Open File

       Select screenset from C:\Mach3

       Select control by clicking it with the left mouse button

       In the properties dialog you'll find the parameters of the selected control

        if standard code 34 is shown you can show the script by double clicking the value column of the execute line

       the script is shown in the builtin editor 

2 when loaded in Mach3

       Mach3 menu Operator -> Edit Button Script 

       All buttons with an assigned script start flashing

        click the button of interest

       the script is shown in an editor, he editor can also be used for testing 





Sample ToggleButton


 This sample uses a LED to show the function. A button click will set the LED on, the next click will set it off.

 Make sure the button number isn't used in the screenset elsewhere




Sample Do On Condition 1


This sample shows how to switch to a specific page only if a password is set




Sample Do On Condition 2


 This sample demonstartes a button click takes only an action if a condition is true. If the Tool Nmb DRO is equal to 5 every "Do On Condition" click will increment the Y-DRO, otherwize no action will be taken.




Sample Keyboard

This sample shows a keyboard.


This sample shows messages, the languge can be set in line 56 of script of key "Enter"


    Lang = LANG_GERMAN 


Operating principles


Select target. In the sample you can select:

    DRO X, DRO Y, DRO Z, DRO A, DRO B, DRO C, MDI, Tool Nmb

type a value

   if Shift-key is clicked, the next entered char will be upper case and the Shift-key is reset

  if Shift Lock is clicked, the next entered char, will be in upper case

    Click Enter to move the value to the selected control



Sample JogStepLED

This script shows how to indicate the actuel Jog Step width using a LED



Sample SetJogStepWidthDirect

This script shows how to set the Jog Step width direct by ticking a button



Sample ToggleButtonColor

This script shows how to to toggle a buttons color depending on on / off state. This is done by adding a LED with the red / green attribut on top of a transparent

image button