Passing var value from rollout to macro script

Hi!

I'm having a problem with a script I wrote. My main script is a macro script which I have assigned to a keyboard shorcut. The other script is a simple rollout with a pickbutton which stores an object in a global variable.

My macroscript should be able to read this global variable, but it only happens if I open a macro editor and evaluate an entire script (instead just using a shortcut). Otherwise it will just keep reporting undefined.

Once the macroscript is evaluated in script editor, I can use the pickbutton in the rollout to change the picked object and macroscript will respond correctly when activated by a keyboard shortcut.

Why does it work only if evaluated once an object is picked? Is there a way around it?

Many thanks in advance for any help or suggestions!

>>>>>>EDIT<<<<<<

Finally found a solution that made my script "usable"! I've added:
fileIn "DropDown.ms"
at the beginning of the UI part, so a macro script gets automatically run every time a UI is started.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
miauu's picture

If isEnable return false On

If isEnable return false On Execute will not be executed.

Arahnoid's picture

Just an idea, maybe it will help

Try to declare your variable (in which you store object) as global outside rollout

 
global myObjectVar
 
--and after rollout
rollout rl_myrolout ...
Alen's picture

Unfortunately that didn't

Unfortunately that didn't make a difference. But I've discovered I don't need to evaluate macro script in script editor; if I run it again using run script, the keyboard shortcut will work...

Does that make sense?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.