sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    πŸ«› Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download

    How to detect if html was opened as a webdialog

    Scheduled Pinned Locked Moved Developers' Forum
    7 Posts 3 Posters 326 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.
    • J Offline
      Jim
      last edited by

      I have a javascript/html application (.hta) that runs as an independent application. Is there a way to have it detect if were opened as a webdialog via SketchUp?

      I tried to test the skp: protocol, but that opened a new window.

      if (window.location="skp:")
      // webdialog
      else
      // sketchup not available

      Hi

      1 Reply Last reply Reply Quote 0
      • J Offline
        Jim
        last edited by

        Darn, Thom must have left work and be out drinking beer and eating cookies already.

        Anyhow, for future reference I ended up checking the window.location.href - which is a file path in both sketchup and the .hta. The webdialog uses a .htm file and the hta uses the same file renamed to .hta. If the filename extension is .htm, sketchup is available.

        Hi

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

          I was drinking beer and playing poker. ...and lost... 😞

          @jim said:

          I tried to test the skp: protocol, but that opened a new window.

          if (window.location="skp:")

          You're assigning window.location to "skp:" - you used a single =
          Like ruby, you must use == to test for equality.

          @jim said:

          Anyhow, for future reference I ended up checking the window.location.href - which is a file path in both sketchup and the .hta. The webdialog uses a .htm file and the hta uses the same file renamed to .hta. If the filename extension is .htm, sketchup is available.

          I don't quite get that. You have a .hta application, you also use that in a Webdialog. You use WebDialog.set_file("myHTA.hta") and window.location.href = "myHTA.htm" ??

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

          1 Reply Last reply Reply Quote 0
          • J Offline
            Jim
            last edited by

            Thanks Thomas,

            I've thought some more and decided I am taking the wrong path. Better to separate out the common features from the sketchup/non-sketchup features; and only include what we need.

            Hi

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

              Now I'm curious to what you're cooking.

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

              1 Reply Last reply Reply Quote 0
              • J Offline
                Jim
                last edited by

                I've been helping Chris Glasier.

                Hi

                1 Reply Last reply Reply Quote 0
                • chrisglasierC Offline
                  chrisglasier
                  last edited by

                  @thomthom said:

                  You have a .hta application, you also use that in a Webdialog. You use WebDialog.set_file("myHTA.hta") and window.location.href = "myHTA.htm" ??

                  Firstly as htas are not compatible with Macs we thought we ought to try and get a WD version working for them.

                  Secondly we know we can launch Sketchup from an hta but we haven't got as far as seeing how to manipulate within it preferably from a single plan/do interface.

                  Anyway thanks again for your help. I thought you deserved some kind of explanation.

                  Regards

                  Chris

                  With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

                  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