You want to save that as m6start.m1s and place it in the macro folder of your profile. For example if you go to Operator menu in Mach and then VB Script Editor a window will pop up, paste it there then file menu and save as option. Browse to your profiles macro folder (eg C:\Mach2\Macros\Mach3Turn) and call it m6start.m1s. There will likely be already one there so just overwrite it. If you have a custom profile it will be that instead of the Mach3Turn in the example above.
To call a tool in Turn its T0101 (orT101 is the same) T0202......... T0808
The first two numbers are the turret position (1 to 8 in your case) and the last two are the offset number, in other words the number in the tool table that you have the tool set to. You could for example have a few tools set up ready to place into a turret position so you may want to call T0101 or T0109 or T0117 etc
Output 2 is just what I used in the macro, you can use any of the outputs but obviously you would need to change it in the macro if you used one of the others. For hooking it up you just assign the port and pin number to the OutPut you wil use (2 in this case) and then on the BOB you would hook up a relay to the pin you have chosen, the coil of the relay would need to be 5v and then the contacts of the relay would power your solenoid, whatever that voltage is.
I have not put a Tool Change position in the macro as I prefer to just do that in my code, two reasons mainly, first is I have twin turrets (front and rear) so going to a set position is not always best as I can have tools in the way. Second is I prefer to decide what the position will be for a toolchange depending on the size of the work, that way I dont have a long way to travel.
If you wanted to add a toolchange position in the VB it would be easy enough, just put
Code"G53 G0 X* Z*)
While IsMoving()
Wend
after the first line of each tool, eg
If GetSelectedTool = 1 Then
Code"G53 G0 X* Z*)
While IsMoving()
Wend
ActivateSignal(OutPut2)
Sleep 500
Code "G53 G0 A0"
While IsMoving()
Wend
DeActivateSignal(OutPut2)
End If
The * would need to be the position you wish to go to, in machine coords.
Oh and one last thing, I put a Sleep 500 in that is a delay to allow your solenoid to operate before the stepper will move, it is 1/2 second so if you can get away with shorter you can change that, for example Sleep 100 would be 1/10th of a second.
Hood