Application Observer
-
Hello,
I've been trying to find it, and I can't seem to, so I thought i'd ask here. I want to have an event occur when the sketchup application is opened...namely, I'd like to open a web dialog box, when sketchup is launched.
I was trying to use a open observer and just launch sketchup with a file, but apparently, a commandstring open doesn't trigger the open observer. (Of course, it works perfect if I go to file open and open a file)
Any tips on how to get a web dialog box to appear when sketchup is opened?
thanks,
Joe
-
Just have your plugin launch the website when it's loaded by including the function call in the script file. Something like this should work.
def launch_web_dialog #insert relevant code here end launch_web_dialog()
Then when your plugin is loaded it will launch the dialog.
-
Any ruby file that exists in the plugins folder will run when SketchUp starts. So, if you want the web page to open every time someone opens SketchUp, not when a new file is open, you can do something like this:
wd = UI;;WebDialog.new("My Page", true) wd.set_file(Sketchup.find_support_file("my_html.html", "Plugins")) wd.show
--
Karen -
@jblively said:
namely, I'd like to open a web dialog box, when sketchup is launched.
Just be careful with this kind of thing. It can slow down SU to have a web dialog opening at the same time, and if it always opens, every time you turn on SU, even if the user is not planning on using your script, then you will have LOTS of angry users. People tend to not like plugins doing things while they are not using the plugin. Generally you get a lot of people just uninstalling the plugin before they can determine whether they really liked it or not.
But maybe under the right circumstances it is forgiveable?
-
seems like an API feature request for a onStartup() callback is in order (for the Sketchup::AppObserver class.)
-
@dan rathbun said:
seems like an API feature request for a onStartup() callback is in order (for the Sketchup::AppObserver class.)
Why? Just ensure a method is called when the plugin loads.
-
@thomthom said:
@dan rathbun said:
seems like an API feature request for a onStartup() callback is in order (for the Sketchup::AppObserver class.)
Why? Just ensure a method is called when the plugin loads.
Because I'm thinking that the calback would get called AFTER all other plugins and extensions are loaded.
Just an idea.
Advertisement