The script has no indications of you using for example
pid << get text
my method of using of using this to travel display boxes is more complicated (but sometimes might be more robust), just using reference should be enough.
Also start with very simple script and get it working first. Start with scripting index example:
Names Default To Here(1);
win = New Window("Example", fontobj = text = Text Edit Box("Example Text"));
Print(text << Get Text());
modify it to have button box
Names Default To Here(1);
win = New Window("Example",
teb = Text Edit Box("Example Text"),
Button Box("Get Text")
);
add function/expression to the button
Names Default To Here(1);
win = New Window("Example",
teb = Text Edit Box("Example Text"),
Button Box("Get Text",
show(teb << get text)
);
);
move the function/expression out of button box
Names Default To Here(1);
get_my_text = function({}, {Default Local},
show(teb << get text)
);
win = New Window("Example",
teb = Text Edit Box("Example Text"),
Button Box("Get Text",
get_my_text();
);
);
make the function return something
Names Default To Here(1);
get_my_text = function({}, {Default Local},
teb_txt = teb << get text;
return(teb_txt);
);
win = New Window("Example",
teb = Text Edit Box("Example Text"),
Button Box("Get Text",
user_txt = get_my_text();
show(user_txt);
);
);
and so on. It is very difficult to try and get the whole script working on one go, so work on much smaller problems one at the time
-Jarmo