• Login
sketchucation logo sketchucation
  • Login
ℹ️ GoFundMe | Our friend Gus Robatto needs some help in a challenging time Learn More

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
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 11 Mar 2008, 23:55

    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 13 Mar 2008, 23:03

      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 13 Jun 2008, 01:32

        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