# On the incorrect loading of the official "htmldialog-examples"

**URL:** <https://forums.sketchup.com/t/on-the-incorrect-loading-of-the-official-htmldialog-examples/84526>\
**Category:** Ruby API\
**Tags:** sketchup\
**Created:** [January 2, 2019, 3:20am UTC](https://forums.sketchup.com/t/on-the-incorrect-loading-of-the-official-htmldialog-examples/84526 "2019-01-02T03:20:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zhangjinheng](https://avatars.discourse-cdn.com/v4/letter/z/f08c70/32.png) [@Zhangjinheng](https://forums.sketchup.com/u/Zhangjinheng)\
**Post date:** [January 2, 2019, 3:20am UTC](https://forums.sketchup.com/t/on-the-incorrect-loading-of-the-official-htmldialog-examples/84526/1 "2019-01-02T03:20:49Z")

</div>

Hello everyone! I’m from China and I’m glad to be here. I’ve only recently come into contact with ruby plug-ins. It’s not long before I get into touch with them. So the following questions may seem childish to you. Okay, please forgive me. Thank you!

The problem lies in:  
I downloaded an “htmldialog-examples” template from github, but I found that I placed it directly under the “Plugin” folder and opened SketchUp and found that the plug-in could not be loaded. So I had to write a script to load it, but it failed in the end. Can you help me solve it?

Here’s my load script, but I don’t know what the problem is.

> **[GitHub - SketchUp/htmldialog-examples: Examples of using SketchUp Ruby API's...](https://github.com/SketchUp/htmldialog-examples)**
>
> Examples of using SketchUp Ruby API's UI::HtmlDialog class - GitHub - SketchUp/htmldialog-examples: Examples of using SketchUp Ruby API's UI::HtmlDialog class

[HtmlDialog Examples.rb](https://forums.sketchup.com/uploads/short-url/jTpkeC6ta9XDtcVCVbAWdiNOQR0.rb) (358 Bytes)

---

<div class="post-metadata">

**Author:** ![SPB](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/spb/32/14638_2.png) [@SPB](https://forums.sketchup.com/u/SPB)\
**Post date:** [February 6, 2019, 9:17am UTC](https://forums.sketchup.com/t/on-the-incorrect-loading-of-the-official-htmldialog-examples/84526/2 "2019-02-06T09:17:06Z")

</div>

Hello you all,  
its very difficult to me to start with html dialogs. I found some examples but I was not able to install them. Especially the above mentioned htmldialog-examples on github. I would be glad someone could explain me how to install them on skechup. Please step by step.  
I downloaded all the files as .zip folder. Where do I have to unpack the files? resp. how to start in sketchuppro.  
Thank you  
spb

---

<div class="post-metadata">

**Author:** ![Aerilius](https://avatars.discourse-cdn.com/v4/letter/a/e19b73/32.png) [@Aerilius](https://forums.sketchup.com/u/Aerilius)\
**Post date:** [February 6, 2019, 11:07am UTC](https://forums.sketchup.com/t/on-the-incorrect-loading-of-the-official-htmldialog-examples/84526/3 "2019-02-06T11:07:30Z")

</div>

- SketchUp loads a Ruby file at startup if it is in the [Plugins folder](https://forums.sketchup.com/t/manually-migrating-extensions/19848) (`C:\Users\<user>\Roaming\SketchUp\SketchUp 2018\Plugins` or `Library/Application Support/SketchUp 2015/SketchUp/Plugins`). The content of the Ruby file is evaluated immediately, so code that is not wrapped in a method and registered in the UI runs at startup.  
Knowing this, you probably have to copy the contents of the **`src` folder into the Plugins** folder.

- Alternatively you can **side-load** scripts from any location if their requirements are specified relative to their loader file (not relative to the Plugins folder). This is the case for these htmldialog-examples.

- Check also out the **sketchup-bridge** project, which provides a different, unified approach to communicating between Ruby and the dialog in both directions.  
You can test-drive it with [this tutorial extension](https://extensions.sketchup.com/en/content/sketchup-bridge-tutorial). If you like it, you can clone the [Github project](https://github.com/Aerilius/sketchup-bridge). There is also a [sample](https://github.com/Aerilius/sketchup-bridge/tree/master/sample) can be copied into your Plugins folder (before making your own project, rename `AuthorName` and `SampleExtension` to your personal namespace).

---

<div class="post-metadata">

**Author:** ![Aerilius](https://avatars.discourse-cdn.com/v4/letter/a/e19b73/32.png) [@Aerilius](https://forums.sketchup.com/u/Aerilius)\
**Post date:** [February 6, 2019, 11:14am UTC](https://forums.sketchup.com/t/on-the-incorrect-loading-of-the-official-htmldialog-examples/84526/4 "2019-02-06T11:14:12Z")

</div>

> [@Zhangjinheng](#):
>
> Here’s my load script, but I don’t know what the problem is.

Did you get any errors?  
I currently cannot test your loader script, but possibly the file extension was missing:

```auto
# …
ext = SketchupExtension.new(("HtmlDialog Examples",File.join(NAME, "tutorial.rb"))
# …

```

If it loads without error but the toolbar is not visible, the extension is maybe not yet enabled (in _Window → Extension Manager_) or the toolbar not enabled (in _View → Toolbars_).

---

<div class="post-metadata">

**Author:** ![wencheasin](https://avatars.discourse-cdn.com/v4/letter/w/96bed5/32.png) [@wencheasin](https://forums.sketchup.com/u/wencheasin)\
**Post date:** [March 15, 2022, 3:46pm UTC](https://forums.sketchup.com/t/on-the-incorrect-loading-of-the-official-htmldialog-examples/84526/5 "2022-03-15T15:46:32Z")

</div>

Hi ZhangjinHeng, actually your problem is the same with SPB’s.  
It is not necessary to use a load program.

Putting the .rb example files into the “plug-in” folder is the right step.  
However, the “.rb file” should be directly at the “plug-in” folder rather than any folders under “plug-in” such as “examples”.  
Then, the extension will load as you re-start trimble or SU.  
You can check it under menu “extensions” \> “extension manager”

The key problem with Github html examples is that they are 1 step from “complete”.  
For example, in the first tutorial “step01.rb”. There are only several methods defined but there are no executive method calls. Therefore, you should add a line to the module:  
“show\_dialog”  
Save it and restart the app again. You will see the html dialog prompts at the app start-up.

I figured this out from Mariocha and Camlaman’s previous topics. I really appreciate their sharing.  
[https://forums.sketchup.com/t/example-html-dialog-suite/79584](https://forums.sketchup.com/t/example-html-dialog-suite/79584)

---

<div class="post-metadata">

**Author:** ![tt\_su](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/tt_su/32/17_2.png) [@tt\_su](https://forums.sketchup.com/u/tt_su)\
**Post date:** [March 16, 2022, 9:27am UTC](https://forums.sketchup.com/t/on-the-incorrect-loading-of-the-official-htmldialog-examples/84526/6 "2022-03-16T09:27:16Z")

</div>

The examples were originally written as a tutorial for reading/watching - accompanying a DevCamp presentation.

But I can see the use in making them easier to run. I logged an issue for that: [Make the examples easily runnable · Issue #5 · SketchUp/htmldialog-examples · GitHub](https://github.com/SketchUp/htmldialog-examples/issues/5)
