You are currently placing the assignment script in a function that is expecting display boxes. Here are the different places you could put the line:
1/ based on your code, you are validating the window based on the value of the prefix, so you could put a line prior to the conditional test
2/ after the new window call, to unpick the contents of the window once the user has clicked OK
3/ inside an onClose event, created using similar syntax to onValidate (achieves the same as (2) but is more elegant and more robust going across Windows/Mac platforms
4/ inside an event handler attached to the display box itself
Given that you are validating the form I would choose the first option:
prefix = "";
win = New Window (" TEST ",
<< Modal,
<< On Validate (
prefix = tt1 << Get Text;
if (Is Missing (prefix),0,1);
),
H List Box (
Text Box (" Define Prefix "),
tt1 = Text Edit Box (""),
),
);
Show (tt1, prefix);
-Dave