Canon,
This seems to work, on my MacBook at any rate. Can’t help with Windows.
C_TEXT($in;$out;$pattern;$model;$swVersion)
LAUNCH EXTERNAL PROCESS("/usr/sbin/system_profiler SPHardwareDataType
SPSoftwareDataType";$in;$out)
ARRAY LONGINT($starts;0)
ARRAY LONGINT($lens;0)
$pattern:="(?m)Model Name: (.*)$(?s:.*)System Version: (.*)"
Match regex($pattern;$out;1;$starts;$lens)
$model:=Substring($out;$starts{1};$lens{1})
$swVersion:=Substring($out;$starts{2};$lens{2})
Jeremy
Jeremy Roussak
[email protected]
> On 13 Jul 2017, at 18:11, Cannon Smith via 4D_Tech <[email protected]>
> wrote:
>
> I’d like to programmatically get two pieces of system information from within
> 4D.
>
> 1. Model name. Ex. "MacBook Pro" or "Inspiron 24 3000".
> 2. OS Version. Ex. "Windows 7.1 SP2" or "macOS 10.12.5"
>
> It needs to work for both platforms. Does anyone have some code to do this
> they wouldn’t mind sharing?
>
> Thanks!
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ: http://lists.4d.com/faqnug.html
Archive: http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:[email protected]
**********************************************************************