Hi Everyone,
Building on this code
https://www.machsupport.com/forum/index.php/topic,23770.0.html I came up with the following
to load DRO values from text file when I was forced to move to Win7.
Rgds,
Tapio
Sub GcodeSelect
Dim MyList()
Begin Dialog GcodeFileDlg 60, 60, 190, 220, "Gcode file selection", .DlgFunc
ListBox 10, 10, 150, 180, MyList(), .List1, 2
CancelButton 42, 198, 40, 12
OKButton 90, 198, 40, 12
End Dialog
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\Reseptit\*.*" )
count = 0
While temp <> ""
count = count + 1
temp = Dir
Wend
Dim x() As String
ReDim x(count)
x(0) = Dir( "c:\Mach3\Reseptit\*.*" )
For i = 1 To count
x(i) = Dir
Next i
DlgListBoxArray "List1", x()
Case 2 ' select
If controlID = "OK" Then
Dim newPos As Double
Open "c:\Mach3\Reseptit\" &DlgText("List1") For Input As #2 'Open the file for reading
UserDROs = 1060
For r = 1060 To 1098
Line Input #2, newPos
DROState = SetUserDRO(UserDROs, newPos)
UserDROs =(UserDROs + 1)
Next r
'Read the first line of the file
Close #2
End If
End Select
End Function