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!
    🚨 Skimp | 25% Off until March 30 Buy Now

    Find computer uuid

    Scheduled Pinned Locked Moved Developers' Forum
    2 Posts 1 Posters 568 Views 1 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.
    • JuantxoJ Offline
      Juantxo
      last edited by

      I would like to find motherboard UUID. I almost did, but in Windows SU2014 I must use

      ...force_encoding("utf-16le")...

      I don't know why and the worst, now one SU2014 Windows user is reporting:

      Error: #<ArgumentError: unknown encoding name - utf-16le>

      Someone have an idea about why sometimes not work in Windows, or have a best method to find UUID?

      Code to find UUID:
      MAC OS:
      uuid = %x(ioreg -l | awk '/IOPlatformSerialNumber/ { print }')
      WIN:
      #RUBY_VERSION 1.8
      cmd="wmic csproduct get uuid" uuid = %x(#{cmd})

      #RUBY_VERSION 2.0 (workaround to fix the backquotes bug included):

      cmd="wmic csproduct get uuid" filename = ENV["TMP"].encode("utf-8") + "\\backquote.out" exec_string = "" + cmd + " > " + filename + "" exec_string.gsub! '\\', '/' eval("#{exec_string}") contents = File.read(filename) uuid= contents.force_encoding("utf-16le").encode('UTF-8') uuid.slice!(0)

      1 Reply Last reply Reply Quote 0
      • JuantxoJ Offline
        Juantxo
        last edited by

        Thanks to Driven and Dan.
        I will use new notation instead use force_encoding. I think now it should works...

        #UUID in RUBY 2.0 WINDOWS
        ` cmd="wmic csproduct get uuid"
        filename = File.join(ENV["TMP"],"backquote.out")

        exec_string = "`" + cmd + " > " + filename + "`"
        exec_string.gsub! '\\', '/'
        eval("#{exec_string}")
        
        uuid=""
        open(filename, "r:BOM|utf-16le:UTF-8") do |io|
        	uuid = io.read
        end`
        
        1 Reply Last reply Reply Quote 0

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better πŸ’—

        Register Login
        • 1 / 1
        • First post
          Last post
        Buy SketchPlus
        Buy SUbD
        Buy WrapR
        Buy eBook
        Buy Modelur
        Buy Vertex Tools
        Buy SketchCuisine
        Buy FormFonts

        Advertisement