The easiest way is to use an [If,…] command and place your sub level commands in there. The [If,…] command can be placed at a top or sub level in your code. Also, unlike containers (Ibutton, Iswitch, etc) the code inside [If,…] commands can be executed automatically when your script is loaded.
[[color=PaleGreen]VarDef, init, 1] //set to 1 which equals TRUE in the following [If,...] command
[[color=PaleGreen]IUnPress, Preferences:Interface:Float Menu]
[VarSet, init, 0] // set init to False
] // End of If command
Your code above will be run one time as soon as the script is loaded. If you do not set the init variable to false, the [If,…] command will loop forever. In that way the [If,…] command differs from other programming languages.
You probably noticed I switched the order of your two commands. It is simply a layout issue. If you do not close the Float Menu before maximizing the Zscript Window you are left with a little canvas still showing.