This code worked for me in the PLC Script to change the button labels.
I am interested in the ability to get and set values to the registers.
looked at it, but just caused Lua and Mach4 to crash several times just trying to get a value.
local SpinCW = scr.GetProperty('ledSpindleCW','Value','Value',0);
local SpinCCW = scr.GetProperty('ledSpindleCCW','Value','Value',0);
if (SpinCW == "1") then
scr.SetProperty('btnSpindleCW', 'Label', 'SpindleCW OFF');
else
scr.SetProperty('btnSpindleCW', 'Label', 'SpindleCW ON');
end
if (SpinCCW == "1") then
scr.SetProperty('btnSpindleCCW', 'Label', 'SpindleCCW OFF');
else
scr.SetProperty('btnSpindleCCW', 'Label', 'SpindleCCW ON');
end