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

    Help to share data between SU Ruby and JS

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 2 Posters 223 Views 2 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.
    • N Offline
      NewOne
      last edited by

      Hello! I need to load the current value from a select box in a variable for further use and my JS skills are very close to zero 😞 . Please help me with this.
      Please edit the attached script to show me how to load the current value from "Val" selectbox in a ruby variable.

      -edit-
      image attachment for visual explanation. I have tried something like this http://blog.techsaints.com/2007/05/06/javascript-how-to-get-selected-item-in-dropdown-select-list/ but couldn't make it to work. I don't fully understand this http://sketchupapi.blogspot.com/2008/02/sharing-data-between-sketchup-ruby-and.html and I'm sure that I made a mistake somewhere, but could not figure out where. That is why I need guidance from someone more experienced

      Thanks for any help.


      test.rb


      visual explanation

      1 Reply Last reply Reply Quote 0
      • T Offline
        todd burch
        last edited by

        I've modified your code to work. I've tested it in Safari. Should work in Windows just fine.

        Todd

        (EDIT - you can remove the <form> tags.)


        test.rb

        1 Reply Last reply Reply Quote 0
        • N Offline
          NewOne
          last edited by

          @unknownuser said:

          I've modified your code to work. I've tested it in Safari. Should work in Windows just fine.

          Todd

          (EDIT - you can remove the <form> tags.)

          Wow! thanks πŸ˜„ I tried something like that (but not really alike) before posting the problem here... and of course it did not worked.
          Thanks again. I will take a closer look to see where I did wrong...I know that I must love JS, but I still hate 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