I'm attempting to access/modify a register from a button using the up/down script functions. Register's do not appear to be accessible from a button however. Trying to print the version of Mach4 here does nothing, meaning it didn't find the register. I know I can access register's from DRO's but why not or HOW can I access them from a button?
local inst = mc.mcGetInstance();
local val = 1
local hreg, rc = mc.mcRegGetHandle(inst, "iregs/2010/IgnoreM6")
rc = mc.mcRegSetValueLong(hreg, val)
if (rc ~= mc.MERROR_NOERROR) then
mc.mcCntlSetLastError(inst, "Error setting iregs/2010/IgnoreM6 ".. rc)
end
inst = mc.mcGetInstance();
hreg,rc = mc.mcRegGetHandle(inst, "core/global/Version")
if (rc == MERROR_NOERROR) then
local rc = mcRegGetValue(hreg)
mc.mcCntlSetLastError(mInst, "rc = " ..rc)
end
return val -- the script MUST return a value, otherwise, the control will not be updated.