• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

Trying to get a string

Scheduled Pinned Locked Moved Developers' Forum
4 Posts 3 Posters 2.6k 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.
  • W Offline
    WEB
    last edited by 6 Feb 2018, 20:58

    In a Ruby script, I would like to set a variable equal to the user's input from the keyboard with no inputbox or dialog slowing things down. It's easy as can be in Ruby: myVariable = gets. Darned if I can figure out how to do it in SketchUp Ruby.

    I'm an absolute newb at this, so I'd appreciate any help you can give.

    1 Reply Last reply Reply Quote 0
    • F Offline
      fredo6
      last edited by 6 Feb 2018, 21:05

      @web said:

      In a Ruby script, I would like to set a variable equal to the user's input from the keyboard with no inputbox or dialog slowing things down. It's easy as can be in Ruby: myVariable = gets. Darned if I can figure out how to do it in SketchUp Ruby.

      I'm an absolute newb at this, so I'd appreciate any help you can give.

      I am afraid that you have to use a dialog box. gets does not work in Sketchup Ruby.

      There are several methods:

      1. Use the UI.inputbox method. This is short to code (a few lines).

      2. Use a WebDialog or HTMLDialog, much longer to code, but you have full freedom on formatting.

      3. If you develop an interactive "Tool" (i.e. class Sketchup::Tool) and you need a numeric input, you can use the VCB input (method UserText())

      Fredo

      1 Reply Last reply Reply Quote 0
      • W Offline
        WEB
        last edited by 7 Feb 2018, 03:29

        Thank you. That explains why I couldn't figure out how to do it. On to Plan B!

        1 Reply Last reply Reply Quote 0
        • D Offline
          Dan Rathbun
          last edited by 10 Feb 2018, 15:20

          @web said:

          That explains why I couldn't figure out how to do it.

          The real reason is because standard IO has been redirected to SketchUp's Ruby Console.

          I'm not here much anymore.

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          1 / 1
          • First post
            1/4
            Last post
          Buy SketchPlus
          Buy SUbD
          Buy WrapR
          Buy eBook
          Buy Modelur
          Buy Vertex Tools
          Buy SketchCuisine
          Buy FormFonts

          Advertisement