I recommend the following snippet:
(Assume a boolean constant PC is set (see 2nd snippet.)
<span class="syntaxdefault"> </span><span class="syntaxcomment"># show the toolbar<br /></span><span class="syntaxdefault"> delay </span><span class="syntaxkeyword">=(</span><span class="syntaxdefault"> Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">version</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">to_i </span><span class="syntaxkeyword">>=</span><span class="syntaxdefault"> 8 </span><span class="syntaxkeyword">?</span><span class="syntaxdefault"> 0.3 </span><span class="syntaxkeyword">;</span><span class="syntaxdefault"> 1.0 </span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> state </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">@@</span><span class="syntaxdefault">toolbar</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">get_last_state <br /> if </span><span class="syntaxkeyword">(</span><span class="syntaxdefault">state </span><span class="syntaxkeyword">==</span><span class="syntaxdefault"> TB_VISIBLE</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> </span><span class="syntaxkeyword">@@</span><span class="syntaxdefault">toolbar</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">restore<br /> </span><span class="syntaxcomment">#<br /></span><span class="syntaxdefault"> </span><span class="syntaxcomment"># Per bug 2902434; resize regression on PC<br /></span><span class="syntaxdefault"> UI</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">start_timer</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">delay</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> false</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">{</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">@@</span><span class="syntaxdefault">toolbar</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">restore </span><span class="syntaxkeyword">}</span><span class="syntaxdefault"> if PC<br /> </span><span class="syntaxcomment">#<br /></span><span class="syntaxdefault"> elsif </span><span class="syntaxkeyword">(</span><span class="syntaxdefault">state </span><span class="syntaxkeyword">==</span><span class="syntaxdefault"> TB_NEVER_SHOWN</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">&&</span><span class="syntaxdefault"> PC<br /> </span><span class="syntaxcomment"># We DONT want to show them until the user wants them,<br /></span><span class="syntaxdefault"> </span><span class="syntaxcomment"># but we cannot leave the state as TB_NEVER_SHOWN, as<br /></span><span class="syntaxdefault"> </span><span class="syntaxcomment"># there is a PC bug that inserts phantom empty toolbar<br /></span><span class="syntaxdefault"> </span><span class="syntaxcomment"># windows up near the menubar, if state is -1.<br /></span><span class="syntaxdefault"> if Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">version</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">to_i </span><span class="syntaxkeyword">>=</span><span class="syntaxdefault"> 8<br /> </span><span class="syntaxcomment"># We show it, then hide it so it will float later.<br /></span><span class="syntaxdefault"> </span><span class="syntaxkeyword">@@</span><span class="syntaxdefault">toolbar</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">show<br /> UI</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">start_timer</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">delay</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> false</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">{</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">@@</span><span class="syntaxdefault">toolbar</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">hide </span><span class="syntaxkeyword">}<br /></span><span class="syntaxdefault"> else </span><span class="syntaxcomment"># vers 6 & 7<br /></span><span class="syntaxdefault"> </span><span class="syntaxkeyword">@@</span><span class="syntaxdefault">toolbar</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">hide </span><span class="syntaxcomment"># Sets last_state to TB_HIDDEN initially.<br /></span><span class="syntaxdefault"> </span><span class="syntaxcomment"># Users may still contend with "toolbar shuffle" later.<br /></span><span class="syntaxdefault"> end<br /> end<br /></span>
If there are any LoadErrors in any startup script.. the toolbars will not resize unless the user closes the LoadError dialog before the delay fires the UI.start_timer block.
Setting platform constants: MAC, OSX, PC, and WIN
(This snippet can be inside your module or class, making them local constants, or you can paste them into the 'Tools/sketchup.rb' file so they get defined as global constants.)
<span class="syntaxdefault"> unless defined</span><span class="syntaxkeyword">?(</span><span class="syntaxdefault">Object</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">MAC</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> <br /> Object</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">MAC </span><span class="syntaxkeyword">=(</span><span class="syntaxdefault"> Object</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">RUBY_PLATFORM </span><span class="syntaxkeyword">=~</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">/</span><span class="syntaxdefault">darwin</span><span class="syntaxkeyword">/</span><span class="syntaxdefault">i </span><span class="syntaxkeyword">?</span><span class="syntaxdefault"> true </span><span class="syntaxkeyword">;</span><span class="syntaxdefault"> false </span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> end<br /> unless defined</span><span class="syntaxkeyword">?(</span><span class="syntaxdefault">Object</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">WIN</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> <br /> Object</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">WIN </span><span class="syntaxkeyword">=(</span><span class="syntaxdefault"> not Object</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">MAC </span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> end<br /> Object</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">OSX </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> Object</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">MAC unless defined</span><span class="syntaxkeyword">?(</span><span class="syntaxdefault">Object</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">OSX</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> Object</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">PC </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> Object</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">WIN unless defined</span><span class="syntaxkeyword">?(</span><span class="syntaxdefault">Object</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">PC</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span>