OK here are a few twqeaks to the routine. The Work Offsets are in G59P### format so you can use any of the 255 available. Also a tweak to allow the program to cycle through tool changes.
Now this works with programs that can run unattended. To stop the batch just feedhold/stop and that will cancel the batch and end the Batchload. To restart simply reload the batch from scratch. DO NOT FEEDHOLD unless you are cancelling the batch. There is an internal call from the Feedhold that will MESS up the WorkOffsetting big time.
I set this up as a button script and call the button AutoBatchLoader
NOTE: for this to work correctly you need to add this statment to your M1030 macro.
SetVar(601,0)
AUTO BATCH LOADER CODE **************************************************
' AutoBatchLoader macro
Dim fname1,fname2,fname3,fname4,fname5 As String
Dim F1WO,F2WO,F3WO,F4WO,F5WO As Single
fname1 ="c:\mach3\gcode\" & AskTextQuestion("File#1 Name?")
F1WO= "" & Question("File#1 Offset in G59 P### Format")
Message(Fname1 & " AND G59 P" & F1WO)
fname2 ="c:\mach3\gcode\" & AskTextQuestion("File#2 Name?")
F2WO= "" & Question("File#2 Offset in G59 P### Format")
Message(Fname2 & " AND G59 P" & F2WO)
fname3 ="c:\mach3\gcode\" & AskTextQuestion("File#3 Name?")
F3WO= "" & Question("File#3 Offset in G59 P### Format")
Message(Fname3 & " AND G59 P" & F3WO)
fname4 ="c:\mach3\gcode\" & AskTextQuestion("File#4 Name?")
F4WO= "" & Question("File#4 Offset in G59 P### Format")
Message(Fname4 & " AND G59 P" & F4WO)
fname5 ="c:\mach3\gcode\" & AskTextQuestion("File#5 Name?")
F5WO= "" & Question("File#5 Offset in G59 P### Format")
Message(Fname5 & " AND G59 P" & F5WO)
For x = 1 To 5
If x = 1 Then loadfile(fname1)
While Isloading()
Sleep(1000)
Wend
If X = 1 Then Code"G59 P" & F1WO
Sleep(1000)
SetVar(601,1)
Sleep(1000)
If x = 2 Then loadfile(fname2)
While Isloading()
Sleep(1000)
Wend
If X = 2 Then Code"G59 P" & F2WO
Sleep(1000)
SetVar(601,1)
Sleep(1000)
If x = 3 Then loadfile(fname3)
While Isloading()
Sleep(1000)
Wend
If X = 3 Then Code"G59 P" & F3WO
Sleep(1000)
SetVar(601,1)
Sleep(1000)
If x = 4 Then loadfile(fname4)
While Isloading()
Sleep(1000)
Wend
If X = 4 Then Code"G59 P" & F4WO
Sleep(1000)
SetVar(601,1)
Sleep(1000)
If x = 5 Then loadfile(fname4)
While Isloading()
Sleep(1000)
Wend
If X = 5 Then Code"G59 P" & F5WO
Sleep(1000)
Setvar(601,1)
Sleep(1000)
Message(filename)
While Isloading()
Sleep(5000)
Wend
runfile()
Sleep(2000)
While Getvar(601)=1
Sleep(2000)
Wend
If Getvar(601)=1 Then End
Next x
Message("End Of Batch Load")
End