Is there a way to detect in AppleScript whether the Mac I’m booted from has a T2 security chip?
Does the System Information application have access to that information? If so, you can likely run the shell command ‘system_profiler’ and get that information.
[format]do shell script “system_profiler”[/format]
I would check the app first and see what section that information is contained within. Then you can restrict system_profiler to that section and then use grep to access the specific line. Details on usage can be found using ‘man system_profiler’ in the Terminal.
There are some posts here that deal with similar usage, like this one:
https://macscripter.net/viewtopic.php?id=35490
There is an applescript command —system info, in Standard Additions— which can tell you the CPU but I would be surprised if it had access to the information you seek.
Browser: Firefox 107.0
Operating System: macOS 10.12
Does that help?
Here is what I cobbled together
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
set myAns to do shell script "system_profiler SPiBridgeDataType"
if myAns contains "T2 Security" then
-- do stuff here that requires T2 Security Chip
end if
Looks good. My system doesn’t generate any data when using the ‘SPiBridgeDataType’ data type —it’s old.
If what you need is ‘basic’, then you could likely possibly speed up the command by using the '-detaillevel option. Also, you could add a grep to your shell command and collect select information.
For example:
This searches for any connected USB devices and returns what they are (by grabbing the two lines above each search hit.
use scripting additions
do shell script "system_profiler SPUSBDataType | grep -B 2 'Product\\ ID'"
(*
" Card Reader:
Product ID: 0x8406
--
Apple Internal Keyboard / Trackpad:
Product ID: 0x0262
--
BRCM20702 Hub:
Product ID: 0x4500
--
Bluetooth USB Host Controller:
Product ID: 0x8289"
*)
This generates a list of applications, looks for Script Debugger amongst them and if present, returns the version number.
set verNum to last word of (do shell script "system_profiler -detaillevel basic SPApplicationsDataType | grep -F -A 2 'Script Debugger' | grep 'Version:'")