I have two DRO's that keeps the value of the displacement of my laser-cross from the spindle tip.
I save these using mcProfileWriteString and read them back using mcProfileGetString and this works fine (when the code is behind buttons).
But I would like to read them automatically each time I start Mach4, so I put this code at the end of the Screen Load Script:
function GetLaserDisp()
local inst = mc.mcGetInstance()
local xVal = mc.mcProfileGetString(inst,"MyUserSettings","LaserDispX","-48.7");
local yVal = mc.mcProfileGetString(inst,"MyUserSettings","LaserDispY","163.9");
scr.SetProperty("droLaserDispX", "Value",tostring(xVal));
scr.SetProperty("droLaserDispY", "Value",tostring(yVal));
mc.mcCntlSetLastError(inst, "GET Laser Point Displacement from file");
end
GetLaserDisp()
The message is displayed but the DRO's are not getting any value?
What am I doing wrong?
(I am a experienced programmer but not that experienced with Mach4 and LUA)