• Login
sketchucation logo sketchucation
  • Login
🤑 30% Off | Artisan 2 on sale until April 30th Buy Now

Application Observer

Scheduled Pinned Locked Moved Developers' Forum
7 Posts 6 Posters 342 Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    jblively
    last edited by 4 Nov 2010, 17:12

    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

    1 Reply Last reply Reply Quote 0
    • C Offline
      Cleverbeans
      last edited by 4 Nov 2010, 21:19

      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.

      1 Reply Last reply Reply Quote 0
      • K Offline
        kwalkerman
        last edited by 4 Nov 2010, 21:43

        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

        1 Reply Last reply Reply Quote 0
        • C Offline
          Chris Fullmer
          last edited by 5 Nov 2010, 00:48

          @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?

          Lately you've been tan, suspicious for the winter.
          All my Plugins I've written

          1 Reply Last reply Reply Quote 0
          • D Offline
            Dan Rathbun
            last edited by 5 Nov 2010, 16:08

            seems like an API feature request for a onStartup() callback is in order (for the Sketchup::AppObserver class.)

            I'm not here much anymore.

            1 Reply Last reply Reply Quote 0
            • T Offline
              thomthom
              last edited by 6 Nov 2010, 08:30

              @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.

              Thomas Thomassen — SketchUp Monkey & Coding addict
              List of my plugins and link to the CookieWare fund

              1 Reply Last reply Reply Quote 0
              • D Offline
                Dan Rathbun
                last edited by 6 Nov 2010, 09:23

                @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.

                I'm not here much anymore.

                1 Reply Last reply Reply Quote 0
                • 1 / 1
                1 / 1
                • First post
                  4/7
                  Last post
                Buy SketchPlus
                Buy SUbD
                Buy WrapR
                Buy eBook
                Buy Modelur
                Buy Vertex Tools
                Buy SketchCuisine
                Buy FormFonts

                Advertisement