sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Launch an Application in RUBY

    Scheduled Pinned Locked Moved Developers' Forum
    14 Posts 3 Posters 1.8k Views 3 Watching
    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.
    • S Offline
      simonstaton
      last edited by

      Thanks for the reply guys,

      it silently fails using my way.

      Tig I tryed your way however the location of the file needing to be run wont always be in the same place however it will be in the same folder of the program everytime so I cannot use the full path will this still working using "../../program.exe"?

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        Can you clarify ? πŸ˜•
        If you know where this file is can't you use the full path ?
        mdir=File.dirname(model.path) gives you a folder then File.join(mdir, myfilename)
        gives the file's path ??
        If it's not the model's folder you are referring to then you might have it coded somewhere so you can use that ?

        TIG

        1 Reply Last reply Reply Quote 0
        • thomthomT Offline
          thomthom
          last edited by

          @simonstaton said:

          Tig I tryed your way however the location of the file needing to be run wont always be in the same place however it will be in the same folder of the program everytime so I cannot use the full path will this still working using "../../program.exe"?

          But you should try with the full path to ensure that the method work. Because if it does, then you know it is your relative path is incorrect. It might be that the working directory is not the one you assume it is.

          You could try File.expand_path() on your relative path and see what absolute path it translates to.

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

          1 Reply Last reply Reply Quote 0
          • S Offline
            simonstaton
            last edited by

            Hi Tig,

            sorry im a bit of a newb when it comes to this stuff πŸ˜„

            I will try and explain from the sketchup folder where you have components etc the file I want to launch is "client/googleearth.exe" however the plugin that is calling it is client "Plugins/Utilities/Toolbar.rb" from the sketchup folder. So what command would I use to call the googleearth.exe from toolbar.rb

            1 Reply Last reply Reply Quote 0
            • S Offline
              simonstaton
              last edited by

              @thomthom said:

              @simonstaton said:

              Tig I tryed your way however the location of the file needing to be run wont always be in the same place however it will be in the same folder of the program everytime so I cannot use the full path will this still working using "../../program.exe"?

              But you should try with the full path to ensure that the method work. Because if it does, then you know it is your relative path is incorrect. It might be that the working directory is not the one you assume it is.

              You could try File.expand_path() on your relative path and see what absolute path it translates to.

              ohh I see now ok I will give that a go.

              1 Reply Last reply Reply Quote 0
              • S Offline
                simonstaton
                last edited by

                ok using the full path didnt work

                1 Reply Last reply Reply Quote 0
                • TIGT Offline
                  TIG Moderator
                  last edited by

                  ge=UI.openURL("C:\\Program Files\\Google\\Google Earth\\client\\googleearth.exe")
                  or
                  ge=UI.openURL("C:/Program Files/Google/Google Earth/client/googleearth.exe")
                  works and opens googleearth
                  ge=UI.openURL('googleearth.exe')
                  doesn't work as it's not been registered to open without a full path [on PC]
                  Note how ' ge' will return true if it succeeds, and false if fails - so if not ge popup a warning message and then run UI.openpanel() for the user to point your tool to googleearth ?

                  TIG

                  1 Reply Last reply Reply Quote 0
                  • S Offline
                    simonstaton
                    last edited by

                    ok that works with the full path however, google earth is not installed on the clients machine it will be inside sketchup in a way so when they install sketchup it will be inside the sketchup folder and where the sketchup folder is depends on where they have installed it on there machine. our clients are not pc friendly at all so keeping it to the basics is probably best

                    1 Reply Last reply Reply Quote 0
                    • TIGT Offline
                      TIG Moderator
                      last edited by

                      @simonstaton said:

                      ok that works with the full path however, google earth is not installed on the clients machine it will be inside sketchup in a way so when they install sketchup it will be inside the sketchup folder and where the sketchup folder is depends on where they have installed it on there machine. our clients are not pc friendly at all so keeping it to the basics is probably best

                      You can find where Sketchup is installed using
                      Sketchup.find_support_file('')
                      which returns something like
                      C:/Program Files/Google/Google SketchUp 7
                      πŸ€“

                      TIG

                      1 Reply Last reply Reply Quote 0
                      • S Offline
                        simonstaton
                        last edited by

                        ah there we go solved, now how would I merge the two? this dosnt seem to be working:

                        ge=UI.openURL(Sketchup.find_support_file('')"/client/googleearth.exe")

                        1 Reply Last reply Reply Quote 0
                        • S Offline
                          simonstaton
                          last edited by

                          dont worry i needed to put a "+" between to two solved! thanks tig

                          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