3021
MACH TOOL BOX / Gcode File section script
« on: March 08, 2013, 12:40:05 PM »
Hi ALL, Here is a button script that allows you to load a gcode file from a set directory and filetype.
(;-) TP
'Gcode Selection Box
Sub GcodeSelect
Dim MyList()
Begin Dialog GcodeFileDlg 60, 60, 190, 220, "MACH3 Gcode Program Select", .DlgFunc
ListBox 10, 10, 150, 180, MyList(), .List1, 2
CancelButton 42, 198, 40, 12
OKButton 90, 198, 40, 12
End Dialog
Dim Button As GcodeFileDlg
Dim frame As GcodeFileDlg
' Show the GcodeFile dialog
Dialog frame
End Sub
Function DlgFunc( controlID As String, action As Integer, suppValue As Integer)
Select Case action
Case 1 ' Initialize
temp = Dir( "c:\Mach3\Gcode\*.tap" )
count = 0
While temp <> ""
count = count + 1
temp = Dir
Wend
Dim x() As String
ReDim x(count)
x(0) = Dir( "c:\Mach3\Gcode\*.tap" )
For i = 1 To count
x(i) = Dir
Next i
DlgListBoxArray "List1", x()
Case 2 ' select
If controlID = "OK" Then
LoadFIle("c:\Mach3\Gcode\" &DlgText("List1"))
End If
End Select
End Function
End
(;-) TP
'Gcode Selection Box
Sub GcodeSelect
Dim MyList()
Begin Dialog GcodeFileDlg 60, 60, 190, 220, "MACH3 Gcode Program Select", .DlgFunc
ListBox 10, 10, 150, 180, MyList(), .List1, 2
CancelButton 42, 198, 40, 12
OKButton 90, 198, 40, 12
End Dialog
Dim Button As GcodeFileDlg
Dim frame As GcodeFileDlg
' Show the GcodeFile dialog
Dialog frame
End Sub
Function DlgFunc( controlID As String, action As Integer, suppValue As Integer)
Select Case action
Case 1 ' Initialize
temp = Dir( "c:\Mach3\Gcode\*.tap" )
count = 0
While temp <> ""
count = count + 1
temp = Dir
Wend
Dim x() As String
ReDim x(count)
x(0) = Dir( "c:\Mach3\Gcode\*.tap" )
For i = 1 To count
x(i) = Dir
Next i
DlgListBoxArray "List1", x()
Case 2 ' select
If controlID = "OK" Then
LoadFIle("c:\Mach3\Gcode\" &DlgText("List1"))
End If
End Select
End Function
End