The attached script window_example is a stripped-down version of the default code for a main window. Try running as it in RPC and you should fail on the line
rc = test_wm_size.rex()
with a message about it not finding a routine. Now change line 20 from AMAX to NORMAL and run again - no problem. (You will get a problem if you try and resize the window, but that's because test_wm_size has been stripped down hard and is missing code form the normal script)