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

    Using open-uri or net/http to download a file from web?

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 3 Posters 1.4k 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.
    • W Offline
      wikii
      last edited by

      Hi all!
      Can I use open-uri or net/http to download a file from web in SU?

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

        Re-posting the lost post...

        One possibility is to use the built-in SKSocket class in SketchUp. The following snippet might be useful:

        
        def listener(s)
          $str << s
          if s == "Connection established"
            SKSocket.write "GET /RubyLibraryDepot/Ruby/weld.rb HTTP/1.0\r\n\n"
          end
          if s == "Connection closed"
            puts "Done"
            # Do something useful with the data
          end
        end
        
        $str = []
        if Sketchup.is_online
          SKSocket.connect "www.crai.archi.fr", 80
          SKSocket.add_socket_listener {|e| listener(e)}
        end
        
        

        Hi

        1 Reply Last reply Reply Quote 0
        • M Offline
          maoltuile
          last edited by

          Could this be used to enforce/update a corporate SketchUp standard installation, I wonder?

          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