1191
General Mach Discussion / Re: Work offset not remembered
« on: July 04, 2019, 01:32:30 PM »
ok with a Little trick
create a button on your Screen witch has the "Name" shutdown Mach or something like this.
this is the code for the button:
create a macro in C:\Mach3\macros\your Profile Name for example M889.M1S
this would be the code for the macro:
then add the M889 to your initialization string
now after restart and pressing the reset button the last workoffset should be restored
create a button on your Screen witch has the "Name" shutdown Mach or something like this.
this is the code for the button:
Code: [Select]
Sub Main()
'save the actual workoffset
Open "C:\Mach3\ActOffset.txt" For Output As #1 ' Open to write file.
'get the actual offset
wo = GetOEMDro(46)+53
Write #1, wo
Close #1
'shut down Mach3
SendKeys "%+{F4}"
End Sub
create a macro in C:\Mach3\macros\your Profile Name for example M889.M1S
this would be the code for the macro:
Code: [Select]
Sub Main()
'read last workoffset
Open "C:\Mach3\ActOffset.txt" for Input As #2 ' Open to read file.
Line Input #2, FileData ' Read a line of data.
Close #2
' make sure that we only restore the WO once
If FileData <> "999" Then
Code "G"&FileData
End if
'clear the WO data
Open "C:\Mach3\ActOffset.txt" For Output As #1 ' Open to write file.
Write #1, 999
Close #1
End Sub
then add the M889 to your initialization string
now after restart and pressing the reset button the last workoffset should be restored