Ruby Script Formatting

Hi there. I’ve just bought a new laptop so am downloading the plugin scripts that I use on my desktop pc onto the new laptop.

Once all have been saved and formatted to the menu bars to where I want them, I finish my work session and close down. When I re-open SUP, all the plugins I’ve added un-format so I have to redock them again.

Any advice would be gratefully appreciated, thanks.

Do you mean the toolbars aren’t in the same place you put them? If so, that would have nothing to do with Ruby script formatting. That would be more typical of incorrect installation of SketchUp.

Quit SketchUp and LayOut. Find the downloaded installer. Right click on it and choose Run as administrator. Then when the option is presented, choose Repair. After that, restart your computer, open SketchUp, place your toolbars as desired, and then open a model or something and press Save. Close SketchUp and reopen. Do the toolbars appear where you put them?

1 Like

Hi, the example code in the SketchUp Ruby API Documentation for loading a toolbar might be causing the problem of you having to re-dock the toolbar buttons again.

Instead of using the following line of code

toolbar.show

It should be replaced with this line of code for the toolbar to remember its last state. This way the docked toolbar will remain where you left it last time.

toolbar.get_last_state == TB_NEVER_SHOWN ? toolbar.show : toolbar.restore

Also, this issue I think is prevalent with Mac OS.

Is your new laptop a Mac or a PC?
Do your docking problems happen with all the extensions or just a couple?

If the Ruby Script you are having issues with is not encrypted, then you might fix it with the example code above. The .rb file might be named menu.rb or maybe load.rb.

Some developers just use toolbar.show for their plugins and cause the problem you are having. Maybe the SketchUp team can update the API.

Hope this helps.

Thanks guys. Will give it a try today.

toolbar.restore

Will do the job without further conditions… :wink:

1 Like

Thanks. I’m using a MS Surface Studio laptop. I did a reboot and 90% of the scripts docked in the right place.

I used to get this issue on my desktop pc from time to time every time SUP brought out another version and I had to reload all the plugins again which is a real pain. If I just added a script here and there, no issues.

1 Like