I tend to request the minimum from system_profiler and clean it further in ruby…
# this will quickly return all MAC Address's
en_all = `system_profiler SPNetworkDataType | grep 'MAC'`
# then use a regular expression to clean up
ary = en_all.chomp!.gsub("\n", ',').gsub(/\s+(Hardware)* \(*MAC\)* Address: /, '').split(',')
with system_profiler report
elapsed time 0.592 seconds
str.len 229
ary.len 5
end with
and the concise output looks like this… [modified results for privacy]
MAC Address: 00:1x:x1:11:11:11
MAC Address: 00:2x:2x:xx:xx:2x:xx:22
MAC Address: 00:3x:x3:x3:33:xx
Serial Number (system): W12345X6XXX
Hardware UUID: 00000000-0000-1000-1000-001XX1111111
-e pattern, --regexp=pattern
Specify a pattern used during the search of the input: an input
line is selected if it matches any of the specified patterns.
This option is most useful when multiple -e options are used to
specify multiple patterns, or when a pattern begins with a dash
(`-').
there are now many mac’s without an ethernet port, maybe @slbaumgartner knows if it’s used internally…
my strategy would be to store 4 or 5 items, but subsequently run as licensed if 2 or more get matched…
Starting a few years ago, Apple stopped putting a separate Ethernet RJ-45 port onto many models and instead required an adapter plugged into either a Thunderbolt or USB-C port. On my MacBook Pro, the Thunderbolt Ethernet shows up in the system_profiler output, but it does not have a MAC address unless the adapter is attached to the mac (it doesn’t have to be connected to an actual ethernet, just attached to the mac). In contrast, the Wi-Fi always has a MAC address, even if Wi-Fi is turned off.
I don’t know about every Mac model, but I suspect this behavior is the same.
Steve and John thanks for your time this Sunday. I appreciate.
Regarding MacAddress
All this making John strategy the only available. Good news is I know ‘what’. One less thing to worry. Bad news is far more work and I no longer see my next week-end off! but your willingness is worth.
I hope ioreg able to save some second tenth and elegantly get UUID and CPU and HDD and SYSTEM serial numbers even step by step.
I haven’t really keep up with this thread, but I recall seeing wmic, shell redirection, MAC Address, Drive SerialNumber, etc. Old code, revised a bit for this, only tested on Win7 & SU2017.
Maybe Win32Ole? If that’s okay, try the following:
# load '<path to this>'
require 'win32ole'
locator = WIN32OLE.new("WbemScripting.SWbemLocator")
wmi = locator.ConnectServer(".", "/root/cimv2")
adapters = wmi.ExecQuery("Select * from Win32_NetworkAdapterConfiguration")
drives = wmi.ExecQuery("Select * from Win32_DiskDrive")
ctr = 0 ; item0 = nil
puts "\n#{'-' * 20} Adapter Info"
adapters.each { |net|
if net.MACAddress
item0 = net if ctr == 0 ; ctr += 1
puts "#{net.MACAddress} #{net.IPEnabled.to_s.ljust(6)} #{(net.IPAddress || []).join(' ')}"
end
}
if item0
puts "\n#{'-' * 20} Adapter Properties"
item0.properties_.each { |prop| puts prop.Name }
end
ctr = 0 ; item0 = nil
puts "\n#{'-' * 20} Drive Info"
drives.each { |drv|
if drv.SerialNumber
item0 = drv if ctr == 0 ; ctr += 1
puts "#{drv.SerialNumber.strip.ljust(20)} #{drv.Description.ljust(20)} #{drv.InterfaceType}"
end
}
if item0
puts "\n#{'-' * 20} Drive Properties"
item0.properties_.each { |prop| puts prop.Name }
end
Great MSP_Greg! it works fine SketchUp 17, 16, 15 and 14. no black window shown.
As far as I remember @DanRathbun made a paper about installing win32ole on SketchUp08 and SketchUp13 but I’m no longer able to find the link. Backward compatibility require such install.
Does anyone remember or explain how to install.
[EDIT] I’ve got the link Win32API and Win32OLE so files
[EDIT] here is @MSP_Greg script on Windows Intel Pentium 2.50GHZ. Mind the two first sub-lines about elapsed time. Mainly the first one related to CPU data.
start version ------------------------------------------------2.2.4
with WindowsManagementInstrumentation, select from key
elapsed time CPU only : 2.094 seconds - below Win32_Processor only!
elapsed time remaining : 0.359 seconds
with Win32_Processor
Name : AMDel(notR) Pentron(notR) CPU Z999 @ 2500GHz
ProcessorId : 0123456789ABCDEF
end with
with Win32_BIOS
SerialNumber : SNEU0123456789ABCDEF00
end with
with Win32_ComputerSystemProduct
UUID : XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
end with
with Win32_VideoController
Name : NVIATI noForce lessThan0
VideoProcessor : lessThan0
end with
with Win32_PhysicalMemory
Capacity : 17179869184
Capacity : 17179869184
end with
with Win32_PhysicalMedia
SerialNumber : 2032111222333444
Tag : \\.\PHYSICALDRIVE1
SerialNumber : ZZ-QWERTYC012345
Tag : \\.\PHYSICALDRIVE0
SerialNumber :
Tag : \\.\CDROM0
end with
end with
---------------------------------------------------------------end
with system_profiler
with SPHardwareDataType
elapsed time 0.497 seconds
str.len 460
ary.len 17
end with
with SPDisplaysDataType
elapsed time 0.402 seconds
str.len 557
ary.len 23
end with
with SPNetworkDataType
elapsed time 0.34 seconds
str.len 2622
ary.len 94
end with
with SPParallelATADataType
elapsed time 0.342 seconds
str.len 314
ary.len 14
end with
full elapsed time 1.583 seconds
end with
digressing a bit
I’m after a way of loading system default client-mail from Ruby with backward compatibility down to SketchUp 8 and cross-platform of course.
I would like to avoid html code. so right from Ruby code.
Maybe I’d better opening a new thread?
Too much! I agree with with you
cross-platform Html mailto: should easily feel our need.
Just one dialog more to build. not so hard at all.
see you soon
then something about system_profiler
on beta-tester computers I got the following from command
`system_profiler SPHardwareDataType`
Hardware:
Hardware Overview:
Model Name: Mac xxx
Model Identifier: MacProx,x
Processor Name: xxxx-Core Intel xxxx
Processor Speed: x,xx GHz
Number of Processors: x
Total Number of Cores: x
L2 Cache (per Core): xxx KB
L3 Cache: x MB
Memory: x GB
Processor Interconnect Speed: x.x GT/s
Boot ROM Version: xxxx.xxxx.xxxx
SMC Version (system): x.xxxx
SMC Version (processor tray): x.xxxx
Serial Number (system): FFFFFFFFFFF
Serial Number (processor tray): FFFFFFFFFFFFF
Hardware UUID: FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF
may you check lines that do not match on your own computer please?
as you may guess it’s all about (processor tray) and UUID, of course!