Get state of IndependentModuleDev?
jjweimer
Do we have a consistent way to determine the state of IndependentModuleDev (0 or 1)? I would like to build one macro to toggle it on/off rather than two macros, one to turn on and one to turn off.
SetIgorOption IndependentModuleDev=?; Print V_Flag
June 6, 2023 at 05:48 am - Permalink
Great! Thanks.
MacrosMenuIMD(),/Q, toggle_IMD()
end
Function/S MacrosMenuIMD()
string rtnstr = "Toggle IMD "
string cmdq = "SetIgorOption independentmoduledev=?"
Execute cmdq
variable/G v_flag
if (v_flag)
rtnstr += "OFF"
else
rtnstr += "ON"
endif
killvariables/Z v_flag
return rtnstr
end
Function toggle_IMD()
string cmdq = "SetIgorOption independentmoduledev=?"
string cmdt = "SetIgorOption independentmoduledev=!(v_flag)"
Execute cmdq
variable/G v_flag
if (v_flag)
print "Independent Module Development OFF"
else
print "Independent Module Development ON"
endif
Execute cmdt
killvariables/Z v_flag
return 0
end
June 6, 2023 at 07:44 am - Permalink
In reply to Great! Thanks. Menu … by jjweimer
An alternative using a menu checkmark:
MacrosMenuIMD(), /Q, toggle_IMD()
end
function/S MacrosMenuIMD()
string rtnstr = "IM development"
string cmdq = "SetIgorOption IndependentModuleDev=?"
Execute cmdq
variable/G v_flag
if (v_flag)
rtnstr += "!" + num2char(18)
endif
KillVariables/Z v_flag
return rtnstr
end
function toggle_IMD()
string cmdq = "SetIgorOption IndependentModuleDev=?"
string cmdt = "SetIgorOption IndependentModuleDev=!(v_flag)"
Execute cmdq
variable/G v_flag
if (v_flag)
Print "Independent Module Development OFF"
else
Print "Independent Module Development ON"
endif
Execute cmdt
KillVariables/Z v_flag
return 0
end
June 6, 2023 at 07:58 am - Permalink