Reset SketchUp Workspace via Ruby

Continuing the discussion from Preference window will not open:

On PC the Automation ID is 3146, going all the way back to v8. (I no longer have v7 installed.)

Sketchup::send_action( 3146 )

I do not know if there is a Mac action string.

These do not work on PC:

Sketchup::send_action( "resetWorkspace:" )

>> false

Sketchup::send_action( "resetWorkSpace:" )

>> false

Sketchup::send_action( "resetDialogs:" )

>> false

Sketchup::send_action( "resetInspectors:" )

>> false

1 Like

on Mac,

Sketchup.send_action("resetWorkspace:")

works

1 Like

So that gives us a cross-platform method:

def reset_sketchup_workspace()
  if (Sketchup.respond_to?(:platform) &&
  Sketchup::platform == :platform_win ) ||
  RUBY_PLATFORM !~ /(darwin)/i
    Sketchup::send_action( 3146 )
  else
    Sketchup::send_action("resetWorkspace:")
  end
end