forked from DonovanChan/fmfunctions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAppleScriptSystemProfiler
99 lines (93 loc) · 2.65 KB
/
AppleScriptSystemProfiler
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
Let ( [
dataTypes = Substitute ( dataTypes ; ¶ ; " " ) ;
db = Get ( FileName ) ;
fieldList = Substitute ( resultFieldName ; "::" ; ¶ ) ;
table = GetValue ( fieldList ; 1 ) ;
field = GetValue ( fieldList ; 2 ) ;
fmpVersion = "FileMaker Pro" & If ( Position ( Get ( ApplicationVersion ) ; "ProAdvanced" ; 1 ; 1 ) ; " Advanced" )
] ;
"set tableName to \"" & table & "\"¶
set fieldName to \"" & field & "\"¶
set dataTypes to \"" & dataTypes & "\"¶
¶
set shellScript to \"system_profiler \" & dataTypes
set myResult do shell script shellScript
¶
setField(db, tableName, fieldName, myResult)¶
¶
------------------------------------------------¶
-- HANDLERS¶
------------------------------------------------¶
¶
--Handler: Sets FileMaker field value¶
on setField(databaseName, tableName, fieldName, theValue)¶
tell application " & Quote ( fmpVersion ) & "¶
tell database (databaseName as text)¶
tell table (tableName as text)¶
set field fieldName to theValue¶
end tell¶
end tell¶
end tell¶
end setField"
)
/* —————————————————————————————— //
NAME:
AppleScriptSystemProfiler ( resultFieldName ; dataTypes )
PURPOSE:
Returns results of `system_profiler` shell command, which provides detailed information about the hardware and operating system configuration.
EXAMPLES:
AppleScriptSystemProfiler (
GetFieldName ( GLOBAL::TEMP_TEXT_GT ) ;
"SPSoftwareDataType SPNetworkDataType"
) // returns report of software and network data of local machine
HISTORY:
Created: 2013-03-20 10:07 PT - Donovan Chandler
NOTES:
See `man system_profiler` in the terminal for info on usage.
Available data types:
SPParallelATADataType
SPUniversalAccessDataType
SPApplicationsDataType
SPAudioDataType
SPBluetoothDataType
SPCardReaderDataType
SPComponentDataType
SPDeveloperToolsDataType
SPDiagnosticsDataType
SPDiscBurningDataType
SPEthernetDataType
SPExtensionsDataType
SPFibreChannelDataType
SPFireWireDataType
SPFirewallDataType
SPFontsDataType
SPFrameworksDataType
SPDisplaysDataType
SPHardwareDataType
SPHardwareRAIDDataType
SPInstallHistoryDataType
SPNetworkLocationDataType
SPLogsDataType
SPManagedClientDataType
SPMemoryDataType
SPModemDataType
SPNetworkDataType
SPPCIDataType
SPParallelSCSIDataType
SPPowerDataType
SPPrefPaneDataType
SPPrintersSoftwareDataType
SPPrintersDataType
SPConfigurationProfileDataType
SPSASDataType
SPSerialATADataType
SPSoftwareDataType
SPStartupItemDataType
SPStorageDataType
SPSyncServicesDataType
SPThunderboltDataType
SPUSBDataType
SPNetworkVolumeDataType
SPWWANDataType
SPAirPortDataType
*/