FUNCTION KEY COMMAND

I have the following code assigned to a function key in order to open and close various windows:

1.  VI ON=2;VI ON=3;VI ON=4 (opens windows 1-4)

2.  VI OF=2;VI OF=3;VI OF=4;VI OF=5;VI OF=6;VI OF=7;VI OF=8 (closes all but window 1)

How can I add a command to the first line to ARRANGE the windows when they all open and consequently MAXIMIZE window 1 when all others close in line 2?