View Full Version : Works as .ms but not .mcr

08-28-2010, 12:42 AM
Can anyone tell me why the following script works without the macroscript header, but not with it.

macroScript LetsGetBakedLean category:"Subdued Software" toolTip:"Open LetsGetBakedLean" icon:#("LetsGetBaked",1)
if $ != undefined then
fn checkDialog = (
local hwnd = dialogMonitorOps.getWindowHandle()
local dialogTitle = uiAccessor.getWindowText hwnd
"made it in: "
if (dialogTitle == "Disable Sun Slave Shadows?") then (
uiAccessor.pressButtonByName hwnd "&Yes"
if (dialogTitle == "Missing Map Targets") then (
uiAccessor.pressButtonByName hwnd "Continue"
if (dialogTitle == "Version control error") then (
uiAccessor.pressButtonByName hwnd "OK"
dialogMonitorOps.interactive = false
dialogMonitorOps.unregisterNotification id:#test
dialogMonitorOps.registerNotification checkDialog id:#test
dialogMonitorOps.enabled = true
fileIn "$userScripts\\LightRigger\\LightRigger.ms"
LightRiggerTGV[3][2].sunmastmultspnr.value=0.65 -- Script Errors out on this line, "no get function for undefined"

This script accesses the UI of another script, LightRigger. I am guessing that embedding all the code as a macroscript somehow changes the scope of the variables, but I don't quite know if it can be fixed. Any thoughts?

08-28-2010, 12:52 AM
If you believe the error message, then LightRiggerTGV is undefined after the fileIn.
Can you add a print to check what the value of LightRiggerTGV is?
Since the fileIn is executed in global scope, I would expect anything created inside that external script to be successfully loaded no matter what.
What is LightRiggerTGV, what scope does it live in and what does it contain (in other words, what is the [3][2] access pointing at?)

CGTalk Moderation
08-28-2010, 12:52 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.