How to set HTML Dialog to the top corner relative to the active model window?

Hello wonderful people,

We now have but not a method for the corner…

How to set the position of a HTMLDialog to the top left corner relative to the active model window?

  • Is there a HACK which will work for this?

1 Like

There is no easy way. The SketchUp application window object is not exposed in the APIs.

Getting it will be different depending upon platform.

On Windows you’ll need to use the Win32::Registry library.

NOTE - This will get the application window when SketchUp was first opened, but will not reflect any window movements or resizing after SketchUp was opened. (Changes are not saved until SketchUp closes.)

require 'win32/registry'

def get_sketchup_window_position
  ver = Sketchup::version.to_i
  if ver == 8
    key = 'SOFTWARE\Google\SketchUp8'
  elsif ver < 8
    return [0,0]
    key = 'SOFTWARE\SketchUp\SketchUp 20' << ver.to_s

  hive = Win32::Registry::HKEY_CURRENT_USER
  size = [0,0]
  hive::open(key) do |reg|
    if reg.keys.include?('MainFrame')'MainFrame') do |frame|
  return size

Note that for SketchUp v8 and v2013, the user would have needed to install the standard library themselves.
I have a Windows only RBZ for this here …

1 Like

I was afraid it required the use of Win32::Registry library.

I remember that @Anton_S have made a succesful attempt as well with ‘ams_WindowSettings’ Extension with the use of Win32::Registry library.

I’ll checkout your Github repository and start experimenting soon.

Once again @DanRathbun thank you so much for your support! You are probably one of the most knowledgeable (had to use auto correct) SketchUp Guru and #SketchUp should hire you as Project Manager!


Like Dan said, it’s not easy but can be achieved. I cracked that a long time ago and wrote an AMS Library with a zillion of functions for manipulating SketchUp window and its child windows. For instance here, is the documenation for obtaining viewport rect:

AMS Library also has an API for blocking particular keys, such WSAD keys, and also acquire the mouse wheel input. For instance, check out this link example for processing keyboard events:

My Windows Settings extension uses my AMS Library to achieve a fancy dialog.

If you intend to write and ship an extension, using AMS Library, then just have AMS Library as a dependency extension; essentially users will have to download two extensions.

One thing to keep in mind is that most AMS Library functions are only accessible on Windows.


That library extension is ONLY for SketchUp v8 and v2013.

The Ruby 2+ Standard Library comes pre-installed on SketchUp v2014 and higher.
Do NOT install it in these newer versions !

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.