liked the feature so much I created a toggle button to turn it on and off and added the other motor count values
Add toggle button, I named it togCounts
Labeled the Text Up and Down condition
set the Button Color and Text Color in both the Up and Down states
Then put this code is at the bottom of the PLC script
local togcountButState = scr.GetProperty("togCounts","Button State", "Button State",'0');
if (togcountButState = '1') then
counts0,rc = mc.mcMotorGetPos(inst, 0, 0);
counts1,rc = mc.mcMotorGetPos(inst, 1, 0);
counts2,rc = mc.mcMotorGetPos(inst, 2, 0);
counts3,rc = mc.mcMotorGetPos(inst, 3, 0);
counts4,rc = mc.mcMotorGetPos(inst, 4, 0);
counts5,rc = mc.mcMotorGetPos(inst, 5, 0);
if (oldcounts0 ~= counts0 or oldcounts1 ~= counts1 or oldcounts2 ~= counts2 or oldcounts3 ~= counts3 or oldcounts4 ~= counts4 or oldcounts5 ~= counts5) then
mc.mcCntlSetLastError(inst, "Counts".." X = " ..tostring(counts0).." Y = " ..tostring(counts1).." Z = " ..tostring(counts2).." A = " ..tostring(counts3).." B = " ..tostring(counts4).." C = " ..tostring(counts5));
oldcounts0 = counts0;
oldcounts1 = counts1;
oldcounts2 = counts2;
oldcounts3 = counts3;
oldcounts4 = counts4;
oldcounts5 = counts5;
end
end