sketchucation logo sketchucation
    • Login
    ℹ️ GoFundMe | Our friend Gus Robatto needs some help in a challenging time Learn More

    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

      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

        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

          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
          • Chris FullmerC Offline
            Chris Fullmer
            last edited by

            @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
            • Dan RathbunD Offline
              Dan Rathbun
              last edited by

              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
              • thomthomT Offline
                thomthom
                last edited by

                @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
                • Dan RathbunD Offline
                  Dan Rathbun
                  last edited by

                  @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
                  • First post
                    Last post
                  Buy SketchPlus
                  Buy SUbD
                  Buy WrapR
                  Buy eBook
                  Buy Modelur
                  Buy Vertex Tools
                  Buy SketchCuisine
                  Buy FormFonts

                  Advertisement