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

    Inputbox prompts by variable

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

      I have a problem once again .

      This code works well:

      
      prompts = ['What is your Name?', 'What is your Age?', 'Gender']  
      defaults = ['Enter name', '', 'Male']  
      list = ['', '', 'Male|Female']  
      input = UI.inputbox prompts, defaults, list, 'Tell me about yourself.'
      
      

      Now I want to give the information by variable.
      For example for 'prompts':

      
      p = "'"What is your Name?"'" + "," + "'"What is your Age?"'" + "," + "'"Gender"'"
      prompts = [p]
      ...
      
      

      But that don“t works!
      What is my mistake?
      Is there another way to solve the problem?
      Or is that not possible?

      With best regards from Germany

      Andreas

      1 Reply Last reply Reply Quote 0
      • honoluludesktopH Offline
        honoluludesktop
        last edited by

        Here are three lines out of one of my programs:

        ` prompts=["Help options: ","Import unit: ","Select origin: ","Polylines: ","Materials: "]

        enums=[update_this, units_list, model_selection, convert_selection, import_texture]

        results=inputbox prompts, a_values, enums, my_file_name+" Options"`

        I have never tried what you seem to be attempting.

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

          In the first example, prompts is an Array of Strings, which is the correct form.

          In the second, p just a String; so when you write prompts = [p], y0u get an Array containing a single String.

          p = [] p << "What is your Name?" << "What is your Age?" << "Gender" prompts = p

          Do not use p as a variable. Although it does work, p is a shortcut for the .inspect method.
          p prompts is the same as puts prompts.inspect

          Hi

          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